EgtGeomKernel 2.3l1 :
- in IntersTriaTria aggiunto riconoscimento triangoli coincidenti - in IntersTriaTria aggiunta distinzione tra intersezione sovrapposta equiversa e controversa.
This commit is contained in:
Binary file not shown.
@@ -116,7 +116,7 @@ IntersSurfTmSurfTm( const ISurfTriMesh& Stm1, const ISurfTriMesh& Stm2,
|
||||
}
|
||||
}
|
||||
// se altrimenti sovrapposizione
|
||||
else if ( nRes == ITTT_OVERLAPS) {
|
||||
else if ( nRes == ITTT_OVERLAPS || nRes == ITTT_COUNTER_OVERLAPS) {
|
||||
for ( const auto& Tria : vIttTria) {
|
||||
// verifico se triangolo già inserito
|
||||
bool bFound = false ;
|
||||
|
||||
+31
-2
@@ -83,8 +83,37 @@ IntersTriaTria( const Triangle3d& trTria1, const Triangle3d& trTria2, Point3d& p
|
||||
// se i triangoli sono complanari
|
||||
if ( nResPP == IPPT_OVERLAPS ||
|
||||
((( nVertPos1 == 0 && nVertNeg1 == 0) || ( nVertPos2 == 0 && nVertNeg2 == 0)) &&
|
||||
( trTria1.GetN() ^ trTria2.GetN()).SqLen() < 25 * SIN_EPS_ANG_SMALL * SIN_EPS_ANG_SMALL))
|
||||
return IntersCoplanarTriaTria( trTria1, trTria2, vTria) ;
|
||||
( trTria1.GetN() ^ trTria2.GetN()).SqLen() < 25 * SIN_EPS_ANG_SMALL * SIN_EPS_ANG_SMALL)) {
|
||||
// verifica per triangoli con normali controverse
|
||||
bool bCounter = false ;
|
||||
Triangle3d trMyTria2 = trTria2 ;
|
||||
if ( trTria1.GetN() * trTria2.GetN() < 0) {
|
||||
Point3d ptV0 = trMyTria2.GetP( 0) ;
|
||||
trMyTria2.SetP( 0, trMyTria2.GetP( 1)) ;
|
||||
trMyTria2.SetP( 1, ptV0) ;
|
||||
trMyTria2.Validate() ;
|
||||
bCounter = true ;
|
||||
}
|
||||
// verifica per triangoli coincidenti
|
||||
bool bAreSameTria = ( ( AreSamePointExact( trTria1.GetP( 0), trMyTria2.GetP( 0)) &&
|
||||
AreSamePointExact( trTria1.GetP( 1), trMyTria2.GetP( 1)) &&
|
||||
AreSamePointExact( trTria1.GetP( 2), trMyTria2.GetP( 2))) ||
|
||||
( AreSamePointExact( trTria1.GetP( 0), trMyTria2.GetP( 1)) &&
|
||||
AreSamePointExact( trTria1.GetP( 1), trMyTria2.GetP( 2)) &&
|
||||
AreSamePointExact( trTria1.GetP( 2), trMyTria2.GetP( 0))) ||
|
||||
( AreSamePointExact( trTria1.GetP( 0), trMyTria2.GetP( 2)) &&
|
||||
AreSamePointExact( trTria1.GetP( 1), trMyTria2.GetP( 0)) &&
|
||||
AreSamePointExact( trTria1.GetP( 2), trMyTria2.GetP( 1)))) &&
|
||||
( AreSameVectorExact( trTria1.GetN(), trMyTria2.GetN())) ;
|
||||
if ( bAreSameTria) {
|
||||
vTria.emplace_back( trTria1) ;
|
||||
return ( bCounter ? ITTT_COUNTER_OVERLAPS : ITTT_OVERLAPS) ;
|
||||
}
|
||||
if ( ITTT_OVERLAPS == IntersCoplanarTriaTria( trTria1, trMyTria2, vTria)) {
|
||||
return ( bCounter ? ITTT_COUNTER_OVERLAPS : ITTT_OVERLAPS) ;
|
||||
}
|
||||
return ITTT_NO ;
|
||||
}
|
||||
|
||||
// limito la linea di intersezione con il primo triangolo
|
||||
Point3d ptSt1, ptEn1 ;
|
||||
|
||||
+12
-6
@@ -1339,9 +1339,12 @@ SurfTriMesh::IntersectTriMeshTriangle( SurfTriMesh& Other)
|
||||
Point3d ptTempA, ptTempB ;
|
||||
int nIntTypeAB = IntersTriaTria( trTriaA, trTriaB, ptTempA, ptTempB, vTriaAB) ;
|
||||
if ( nIntTypeAB == ITTT_OVERLAPS) {
|
||||
bool bInvertB = trTriaA.GetN() * trTriaB.GetN() < 0. ;
|
||||
m_vTria[nTA].nTempPart = ( bInvertB ? -2 : 2) ;
|
||||
SurfB.m_vTria[vNearTria[nTB]].nTempPart = ( bInvertB ? - 2 : 2) ;
|
||||
m_vTria[nTA].nTempPart = 2 ;
|
||||
SurfB.m_vTria[vNearTria[nTB]].nTempPart = 2 ;
|
||||
}
|
||||
else if ( nIntTypeAB == ITTT_COUNTER_OVERLAPS) {
|
||||
m_vTria[nTA].nTempPart = -2 ;
|
||||
SurfB.m_vTria[vNearTria[nTB]].nTempPart = -2 ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3663,9 +3666,12 @@ SurfTriMesh::IntersectTriMeshFacets( SurfTriMesh& Other)
|
||||
}
|
||||
// Se l'intersezeione è corretta e i triangoli sono sovrapposti aggiorno gli indici.
|
||||
if ( nIntTypeAB == ITTT_OVERLAPS && bSuccesfullInters) {
|
||||
bool bInvertB = trTriaA.GetN() * trTriaB.GetN() < 0. ;
|
||||
m_vTria[nTA].nTempPart = ( bInvertB ? -2 : 2) ;
|
||||
SurfB.m_vTria[vNearTria[nTB]].nTempPart = ( bInvertB ? - 2 : 2) ;
|
||||
m_vTria[nTA].nTempPart = 2 ;
|
||||
SurfB.m_vTria[vNearTria[nTB]].nTempPart = 2 ;
|
||||
}
|
||||
else if ( nIntTypeAB == ITTT_COUNTER_OVERLAPS && bSuccesfullInters) {
|
||||
m_vTria[nTA].nTempPart = - 2 ;
|
||||
SurfB.m_vTria[vNearTria[nTB]].nTempPart = - 2 ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user