EgtGeomKernel :

- modifiche a sistemazione topologie di intersezioni di curve composite
- eliminazione di linee inutili in generale
- cambio nome di variabili che nascondono omonime.
This commit is contained in:
Dario Sassi
2020-10-05 06:56:24 +00:00
parent 74df7ecfcd
commit be027def9c
18 changed files with 152 additions and 232 deletions
+17 -23
View File
@@ -337,7 +337,6 @@ SurfTriMesh::GeneralizedCut( const ICurve& cvCurve, bool bSaveOnEq)
// Vettore di catene di punti
CHAINVECTOR vChain ;
// Ciclo sui segmenti
bool bStartInside = false ;
int nChainCnt = 0 ;
bool bChain = false ;
Point3d ptChSt, ptChEn ;
@@ -572,7 +571,6 @@ SurfTriMesh::GeneralizedCut( const ICurve& cvCurve, bool bSaveOnEq)
cvBoundClosedLoopVec[nCL + 1] = cvBoundClosedLoopVec[nCL] ;
vbInOut[nCL + 1] = vbInOut[nCL] ;
}
int nLastPointLoop2 = int( Loop2.size()) - 1 ;
Vector3d vtTest = Loop1[1] - Loop1[0] ;
vtTest.Normalize() ;
bool bSecondInside = vtTest * cvOpenChain[nLastOpenLoopN][0].vtOuter < 0. ;
@@ -590,7 +588,6 @@ SurfTriMesh::GeneralizedCut( const ICurve& cvCurve, bool bSaveOnEq)
vtVecProva.Normalize( EPS_ZERO) ;
for ( int nLoop = 0 ; nLoop < int( cvBoundClosedLoopVec.size()) ; ++ nLoop) {
// Estremi del loop aperto
int nLastOpenLoopPoint = max(int(cvOpenChain[nLastOpenLoopN].size()) - 1, 0) ;
Point3d ptOpenLoopStP = cvOpenChain[nLastOpenLoopN][0].ptSt ;
Point3d ptOpenLoopEnP = cvOpenChain[nLastOpenLoopN][0].ptEn ;
// Cerco se esistono dei tratti del loop chiuso corrente che sono
@@ -794,7 +791,6 @@ SurfTriMesh::DecomposeLoop( CHAINVECTOR& cvOpenChain, INTVECTOR& vnDegVec, PNTMA
vtVecProva.Normalize( EPS_ZERO) ;
for ( int nLoop = 0 ; nLoop < int( cvBoundClosedLoopVec.size()) ; ++ nLoop) {
// Estremi del loop aperto
int nLastOpenLoopPoint = max( int( cvOpenChain[nLastOpenLoopN].size()) - 1, 0) ;
Point3d ptOpenLoopStP = cvOpenChain[nLastOpenLoopN][0].ptSt ;
Point3d ptOpenLoopEnP = cvOpenChain[nLastOpenLoopN][0].ptEn ;
// Cerco se esistono dei tratti del loop chiuso corrente che sono
@@ -1231,7 +1227,7 @@ SurfTriMesh::RetriangulationForBooleanOperation( CHAINMAP& LoopLines, TRIA3DVECT
bool bPointOnSt = false ;
bool bPointOnEn = false ;
int nSegNum = 0 ;
int nSegMin ;
int nSegMin = 0 ;
Point3d ptS, ptE ;
bool bContinueS = vplPolyVec[nLoop].GetFirstPoint( ptS) ;
bool bContinueE = vplPolyVec[nLoop].GetNextPoint( ptE) ;
@@ -1261,10 +1257,10 @@ SurfTriMesh::RetriangulationForBooleanOperation( CHAINMAP& LoopLines, TRIA3DVECT
Vector3d vtTan = ptE - ptS ;
vtTan.Normalize() ;
Vector3d vtOut = vtTan ^ trTria.GetN() ;
Point3d ptMinDist ;
Point3d ptMinDist2 ;
DistPointLine DistCalculator( ptLoopStart, ptS, ptE) ;
DistCalculator.GetMinDistPoint( ptMinDist) ;
double dMinDistDot = ( ptLoopStart - ptMinDist) * vtOut ;
DistCalculator.GetMinDistPoint( ptMinDist2) ;
double dMinDistDot = ( ptLoopStart - ptMinDist2) * vtOut ;
if ( dMinDistDot < - EPS_SMALL) {
vInnerLoop.emplace_back( nCLI) ;
break ;
@@ -1468,13 +1464,13 @@ SurfTriMesh::RetriangulationForBooleanOperation( CHAINMAP& LoopLines, TRIA3DVECT
// Lista dei punti della PolyLine Loop corrente
PNTULIST& LoopPointList = vPolygons[nL].GetUPointList() ;
// Ciclo sui segmenti
auto itSt = LoopPointList.begin() ;
auto itEn = itSt ;
++ itEn ;
for ( ; itSt != LoopPointList.end() && itEn != LoopPointList.end() ; ++ itSt, ++ itEn) {
auto itSt2 = LoopPointList.begin() ;
auto itEn2 = itSt2 ;
++ itEn2 ;
for ( ; itSt2 != LoopPointList.end() && itEn2 != LoopPointList.end() ; ++ itSt2, ++ itEn2) {
// Segmento corrente
Point3d ptSt = itSt->first ;
Point3d ptEn = itEn->first ;
Point3d ptSt = itSt2->first ;
Point3d ptEn = itEn2->first ;
Vector3d vtSeg = ptEn - ptSt ;
double dSegLen = vtSeg.Len() ;
vtSeg /= dSegLen ;
@@ -1483,7 +1479,7 @@ SurfTriMesh::RetriangulationForBooleanOperation( CHAINMAP& LoopLines, TRIA3DVECT
// Ciclo su tutti i punti non del segmento corrente
auto itP = LoopPointList.begin() ;
for ( ; itP != LoopPointList.end() ; ++ itP) {
if ( itP != itSt && itP != itEn) {
if ( itP != itSt2 && itP != itEn2) {
Point3d ptP = itP->first ;
DistPointLine DistCalculator( ptP, ptSt, ptEn) ;
double dDist ;
@@ -1507,7 +1503,7 @@ SurfTriMesh::RetriangulationForBooleanOperation( CHAINMAP& LoopLines, TRIA3DVECT
}
// Aggiungo i punti al loop esterno
for ( int nPi = 0 ; nPi < int( vAddingPointWithOrder.size()) ; ++ nPi) {
itSt = LoopPointList.emplace( itEn, vAddingPointWithOrder[nPi]) ;
itSt2 = LoopPointList.emplace( itEn2, vAddingPointWithOrder[nPi]) ;
}
}
// Spezzo i loop autointersecantesi
@@ -1520,9 +1516,9 @@ SurfTriMesh::RetriangulationForBooleanOperation( CHAINMAP& LoopLines, TRIA3DVECT
bSplitted = false ;
for ( int nl = 0 ; nl < int( vAuxPolygons.size()) ; ++ nl) {
PNTULIST& PntLst = vAuxPolygons[nl].GetUPointList() ;
std::vector<Point3d> vPoint ;
for ( auto it = PntLst.begin() ; it != PntLst.end() ; ++ it) {
vPoint.emplace_back( it->first) ;
PNTVECTOR vPoint ;
for ( auto it2 = PntLst.begin() ; it2 != PntLst.end() ; ++ it2) {
vPoint.emplace_back( it2->first) ;
}
int nStartPt = -1 ;
int nEndPt = int( vPoint.size()) ;
@@ -1774,7 +1770,6 @@ SurfTriMesh::IntersectTriMeshTriangle( SurfTriMesh& Other)
// Recupero i triangoli di B che interferiscono col box del triangolo di A
INTVECTOR vNearTria ;
SurfB.GetAllTriaOverlapBox( b3dTriaA, vNearTria) ;
bool bNewTriaA = true ;
for ( int nTB = 0 ; nTB < int( vNearTria.size()) ; ++ nTB) {
// Se il triangolo B non è valido, continuo
Triangle3d trTriaB ;
@@ -2012,10 +2007,10 @@ SurfTriMesh::IntersectTriMeshTriangle( SurfTriMesh& Other)
bContinue = ( AdjustVertices() && DoCompacting() && SurfB.AdjustVertices() && SurfB.DoCompacting()) ;
// Triangoli sovrapposti
if ( bContinue) {
int nTriaNumA = GetTriangleSize() ;
int nTriaNum2A = GetTriangleSize() ;
// Resetto e ricalcolo la HashGrid della superficie B
SurfB.ResetHashGrids3d() ;
for ( int nTA = 0 ; nTA < nTriaNumA ; ++ nTA) {
for ( int nTA = 0 ; nTA < nTriaNum2A ; ++ nTA) {
// Se il triangolo A non è valido, continuo
Triangle3d trTriaA ;
if ( ! GetTriangle( nTA, trTriaA) || ! trTriaA.Validate( true))
@@ -2026,7 +2021,6 @@ SurfTriMesh::IntersectTriMeshTriangle( SurfTriMesh& Other)
// Recupero i triangoli di B che interferiscono col box del triangolo di A
INTVECTOR vNearTria ;
SurfB.GetAllTriaOverlapBox( b3dTriaA, vNearTria) ;
bool bNewTriaA = true ;
for ( int nTB = 0 ; nTB < int( vNearTria.size()) ; ++ nTB) {
// Se il triangolo B non è valido, continuo
Triangle3d trTriaB ;