diff --git a/SbzFromCurves.cpp b/SbzFromCurves.cpp index 9a181cf..df830ff 100644 --- a/SbzFromCurves.cpp +++ b/SbzFromCurves.cpp @@ -63,9 +63,16 @@ GetSurfBezierByRegion( const CICURVEPVECTOR& vpCurve, double dLinTol) if ( &vpCurve == nullptr || vpCurve.empty()) return nullptr ; // calcolo le polilinee che approssimano le curve della regione + POLYLINEVECTOR vPLOrd ; POLYLINEVECTOR vPL ; + vPL.resize( vpCurve.size()) ; + for ( int i = 0 ; i < int( vpCurve.size()) ; ++ i) { + if ( ! vpCurve[i]->ApproxWithLines( dLinTol, ANG_TOL_STD_DEG, ICurve::APL_SPECIAL, vPL[i])) + return false ; + } Vector3d vtN ; - if ( ! CalcRegionPolyLines( vpCurve, dLinTol, vPL, vtN)) + INTMATRIX vnPLIndMat ; + if ( ! CalcRegionPolyLines( vPL, vPLOrd, vtN, vnPLIndMat)) return nullptr ; //for ( int i = 0 ; i < int(vpCurve.size()) ; ++i ) { // PolyLine pl ; @@ -74,7 +81,7 @@ GetSurfBezierByRegion( const CICURVEPVECTOR& vpCurve, double dLinTol) //} // creo e setto la superficie di bezier PtrOwner pSbz( CreateBasicSurfBezier()) ; - if ( IsNull( pSbz) || ! pSbz->CreateByRegion( vPL)) + if ( IsNull( pSbz) || ! pSbz->CreateByRegion( vPLOrd)) return nullptr ; //// salvo tolleranza lineare usata //pSbz->SetLinearTolerance( dLinTol) ; diff --git a/SfrCreate.cpp b/SfrCreate.cpp index 3e34479..c019618 100644 --- a/SfrCreate.cpp +++ b/SfrCreate.cpp @@ -575,19 +575,11 @@ SurfFlatRegionByContours::GetUnusedCurveTempProps( INTVECTOR& vId) //------------------------------------------------------------------------------- bool -CalcRegionPolyLines( const CICURVEPVECTOR& vpCurve, double dLinTol, - POLYLINEVECTOR& vPL, Vector3d& vtN) +CalcRegionPolyLines( const POLYLINEVECTOR& vPL, POLYLINEVECTOR& vPLOrd, Vector3d& vtN, INTMATRIX& vnPLIndMat) { - // se non ho curve, non faccio nulla - if ( int( vpCurve.size()) == 0) - return true ; - - // calcolo le polilinee che approssimano le curve - vPL.resize( vpCurve.size()) ; - for ( int i = 0 ; i < int( vpCurve.size()) ; ++ i) { - if ( ! vpCurve[i]->ApproxWithLines( dLinTol, ANG_TOL_STD_DEG, ICurve::APL_SPECIAL, vPL[i])) - return false ; - } + // matrice di interi : ogni riga corrisponde ad un chunk, dove in posizione 0 c'è il loop esterno e nelle + // successive i loop interni + //INTMATRIX vnPLIndMat ; // ricavo versore normale Plane3d plPlane ; double dArea ; @@ -599,6 +591,7 @@ CalcRegionPolyLines( const CICURVEPVECTOR& vpCurve, double dLinTol, std::vector m_vArea ; // calcolo piano medio e area delle curve m_vArea.reserve( vPL.size()) ; + VCT3DVECTOR vvtN ; for ( int i = 0 ; i < int( vPL.size()) ; ++ i) { // calcolo piano medio e area Plane3d plPlane ; @@ -608,6 +601,8 @@ CalcRegionPolyLines( const CICURVEPVECTOR& vpCurve, double dLinTol, // verifico che le normali siano molto vicine if ( ! AreSameOrOppositeVectorApprox( plPlane.GetVersN(), vtN)) return false ; + // salvo la normale + vvtN.push_back( plPlane.GetVersN()) ; // assegno il segno all'area secondo il verso della normale if ( ( plPlane.GetVersN() * vtN) > 0) m_vArea.emplace_back( i, dArea) ; @@ -629,16 +624,17 @@ CalcRegionPolyLines( const CICURVEPVECTOR& vpCurve, double dLinTol, vCrvCompo[i]->ToLoc( frRef) ; } - // creo una matrice di interi ; ogni riga corrisponde ad un chunk, dove in posizione 0 c'è il loop esterno e nelle - // successive i loop interni - INTMATRIX vnPLIndMat ; + // restituisco la normale del loop più grande + bool bInvertAll = vvtN[m_vArea[0].first] * vtN < 0 ; + vtN = vvtN[m_vArea[0].first] ; - // vettore di indici per ordinare le PolyLine + //// vettore di indici per ordinare le PolyLine INTVECTOR vPL_IndOrder ; vPL_IndOrder.resize( int( vPL.size())) ; for ( int i = 0 ; i < int( m_vArea.size()) ; ++ i) vPL_IndOrder[i] = m_vArea[i].first ; // aggiungo le diverse curve + vPLOrd = vPL ; bool bFirstCrv ; Plane3d plExtLoop ; double dAreaExtLoop = 0. ; @@ -656,7 +652,7 @@ CalcRegionPolyLines( const CICURVEPVECTOR& vpCurve, double dLinTol, dAreaExtLoop = m_vArea[i].second ; // inverto se necessario if ( m_vArea[i].second < EPS_SMALL) { - vPL[j].Invert() ; + vPLOrd[j].Invert() ; vCrvCompo[j]->Invert() ; dAreaExtLoop *= -1 ; } @@ -691,7 +687,7 @@ CalcRegionPolyLines( const CICURVEPVECTOR& vpCurve, double dLinTol, m_vArea[i].first = -1 ; // inverto se necessario if ( m_vArea[i].second * dAreaExtLoop > 0.) { - vPL[j].Invert() ; + vPLOrd[j].Invert() ; vCrvCompo[j]->Invert() ; } } @@ -699,11 +695,22 @@ CalcRegionPolyLines( const CICURVEPVECTOR& vpCurve, double dLinTol, } } while ( ! bFirstCrv) ; - // ordino le PolyLine per area - POLYLINEVECTOR vPL_tmp ; - for ( int i = 0 ; i < int( vPL_IndOrder.size()) ; ++ i) - vPL_tmp.push_back( vPL[ vPL_IndOrder[i]]) ; - swap( vPL, vPL_tmp) ; + if ( bInvertAll) { + for ( int i = 0 ; i < int( vPLOrd.size()) ; ++i) + vPLOrd[i].Invert() ; + } + + //// ordino le PolyLine per area + // POLYLINEVECTOR vPL_tmp ; + // for ( int i = 0 ; i < int( vPL_IndOrder.size()) ; ++ i) + // vPL_tmp.push_back( vPLOrd[ vPL_IndOrder[i]]) ; + + //for ( int i = 0 ; i < int( vnPLIndMat.size()) ; ++i) { + // for ( int j = 0 ; j < int( vnPLIndMat[i].size()) ; ++j ) { + // vPL_tmp.push_back( vPLOrd[vnPLIndMat[i][j]]) ; + // } + //} + //swap( vPLOrd, vPL_tmp) ; return true ; } diff --git a/StmFromCurves.cpp b/StmFromCurves.cpp index 2681463..198f1d1 100644 --- a/StmFromCurves.cpp +++ b/StmFromCurves.cpp @@ -60,13 +60,20 @@ GetSurfTriMeshByRegion( const CICURVEPVECTOR& vpCurve, double dLinTol) if ( &vpCurve == nullptr || vpCurve.empty()) return nullptr ; // calcolo le polilinee che approssimano le curve della regione + POLYLINEVECTOR vPLOrd ; POLYLINEVECTOR vPL ; + vPL.resize( vpCurve.size()) ; + for ( int i = 0 ; i < int( vpCurve.size()) ; ++ i) { + if ( ! vpCurve[i]->ApproxWithLines( dLinTol, ANG_TOL_STD_DEG, ICurve::APL_SPECIAL, vPL[i])) + return false ; + } Vector3d vtN ; - if ( ! CalcRegionPolyLines( vpCurve, dLinTol, vPL, vtN)) + INTMATRIX vnPLIndMat ; + if ( ! CalcRegionPolyLines( vPL, vPLOrd, vtN, vnPLIndMat)) return nullptr ; // creo e setto la superficie trimesh PtrOwner pSTM( CreateBasicSurfTriMesh()) ; - if ( IsNull( pSTM) || ! pSTM->CreateByRegion( vPL)) + if ( IsNull( pSTM) || ! pSTM->CreateByRegion( vPLOrd, vnPLIndMat)) return nullptr ; // salvo tolleranza lineare usata pSTM->SetLinearTolerance( dLinTol) ; @@ -141,8 +148,15 @@ GetSurfTriMeshByRegionExtrusion( const CICURVEPVECTOR& vpCurve, const Vector3d& return GetSurfTriMeshByExtrusion( vpCurve[0], vtExtr, true, dLinTol) ; // calcolo le polilinee che approssimano le curve della regione POLYLINEVECTOR vPL ; + POLYLINEVECTOR vPLOrd ; + vPL.resize( vpCurve.size()) ; + for ( int i = 0 ; i < int( vpCurve.size()) ; ++ i) { + if ( ! vpCurve[i]->ApproxWithLines( dLinTol, ANG_TOL_STD_DEG, ICurve::APL_SPECIAL, vPL[i])) + return false ; + } Vector3d vtN ; - if ( ! CalcRegionPolyLines( vpCurve, dLinTol, vPL, vtN)) + INTMATRIX vnPLIndMat ; + if ( ! CalcRegionPolyLines( vPL, vPLOrd, vtN, vnPLIndMat)) return nullptr ; // verifico la direzione di estrusione double dOrthoExtr = vtN * vtExtr ; @@ -155,7 +169,7 @@ GetSurfTriMeshByRegionExtrusion( const CICURVEPVECTOR& vpCurve, const Vector3d& } // creo la prima superficie di estremità PtrOwner pSTM( CreateBasicSurfTriMesh()) ; - if ( IsNull( pSTM) || ! pSTM->CreateByRegion( vPL)) + if ( IsNull( pSTM) || ! pSTM->CreateByRegion( vPLOrd, vnPLIndMat)) return nullptr ; // creo la seconda superficie e la unisco alla prima { // copio la prima superficie @@ -172,7 +186,7 @@ GetSurfTriMeshByRegionExtrusion( const CICURVEPVECTOR& vpCurve, const Vector3d& for ( int i = 0 ; i < int( vPL.size()) ; ++ i) { // estrusione SurfTriMesh STM2 ; - if ( ! STM2.CreateByExtrusion( vPL[i], vtExtr)) + if ( ! STM2.CreateByExtrusion( vPLOrd[i], vtExtr)) return nullptr ; // la unisco alla superficie principale if ( ! pSTM->DoSewing( STM2)) @@ -1276,7 +1290,8 @@ GetSurfTriMeshSwept( const ISurfFlatRegion* pSfrSect, const ICurve* pGuide, cons } // creo il cap sull'inizio e lo attacco alla swept ( è già in posizione giusta) PtrOwner pSci( CreateSurfTriMesh()) ; - if ( ! pSci->CreateByRegion( vPLi)) + INTMATRIX vnPLIndMat ; + if ( ! pSci->CreateByRegion( vPLi, vnPLIndMat)) return nullptr ; pStmSwept->DoSewing( *pSci) ; // recupero i loops alla fine @@ -1285,7 +1300,8 @@ GetSurfTriMeshSwept( const ISurfFlatRegion* pSfrSect, const ICurve* pGuide, cons return nullptr ; // creo la superficie alla fine e la attacco PtrOwner pSce( CreateSurfTriMesh()) ; - if ( ! pSce->CreateByRegion( vPLe)) + vnPLIndMat.clear() ; + if ( ! pSce->CreateByRegion( vPLe, vnPLIndMat)) return nullptr ; // attacco la superficie finale alla swept pSce->Invert() ; diff --git a/SurfFlatRegion.cpp b/SurfFlatRegion.cpp index 4c60547..2327d42 100644 --- a/SurfFlatRegion.cpp +++ b/SurfFlatRegion.cpp @@ -1211,7 +1211,8 @@ SurfFlatRegion::CalcAuxSurf( double dLinTol, double dAngTolDeg) const if ( vPL[0].GetAreaXY( dArea) && dArea > 100 * SQ_EPS_SMALL) { // creo, setto la superficie trimesh ed elimino punti ripetuti PtrOwner pChSTM( CreateBasicSurfTriMesh()) ; - if ( IsNull( pChSTM) || ! pChSTM->CreateByRegion( vPL) || ! pChSTM->DoCompacting()) + INTMATRIX vnPLIndMat ; + if ( IsNull( pChSTM) || ! pChSTM->CreateByRegion( vPL, vnPLIndMat) || ! pChSTM->DoCompacting()) return nullptr ; // porto la trimesh in globale al riferimento intrinseco pChSTM->ToGlob( m_frF) ; diff --git a/SurfTriMesh.cpp b/SurfTriMesh.cpp index e9ab10f..8a64e24 100644 --- a/SurfTriMesh.cpp +++ b/SurfTriMesh.cpp @@ -2093,13 +2093,13 @@ SurfTriMesh::CreateByFlatContour( const PolyLine& PL) //---------------------------------------------------------------------------- bool -SurfTriMesh::CreateByRegion( const POLYLINEVECTOR& vPL) +SurfTriMesh::CreateByRegion( const POLYLINEVECTOR& vPL, const INTMATRIX& vnPLIndMat) { // eseguo la triangolazione, dopo aver verificato che l'insieme di contorni costituisca una regione PNTVECTOR vPnt ; INTVECTOR vTria ; Triangulate Tri ; - if ( ! Tri.MakeAdvanced( vPL, vPnt, vTria)) + if ( ! Tri.MakeAdvanced( vPL, vPnt, vTria, vnPLIndMat)) return false ; // inizializzo la superficie diff --git a/SurfTriMesh.h b/SurfTriMesh.h index 5b3c803..08a0e00 100644 --- a/SurfTriMesh.h +++ b/SurfTriMesh.h @@ -251,7 +251,7 @@ class SurfTriMesh : public ISurfTriMesh, public IGeoObjRW bool RemoveTriangle( int nId) override ; bool AdjustTopology( void) override ; bool CreateByFlatContour( const PolyLine& PL) override ; - bool CreateByRegion( const POLYLINEVECTOR& vPL) override ; + bool CreateByRegion( const POLYLINEVECTOR& vPL, const INTMATRIX& vnPLIndMat) override ; bool CreateByExtrusion( const PolyLine& PL, const Vector3d& vtExtr) override ; bool CreateByPointCurve( const Point3d& ptP, const PolyLine& PL) override ; bool CreateByTwoCurves( const PolyLine& PL1, const PolyLine& PL2, int nRuledType) override ; diff --git a/Triangulate.cpp b/Triangulate.cpp index 79c123e..5768c07 100644 --- a/Triangulate.cpp +++ b/Triangulate.cpp @@ -17,6 +17,7 @@ #include "Triangulate.h" #include "ProjPlane.h" #include "earcut.hpp" +#include "/EgtDev/Include/EGkSfrCreate.h" #include "/EgtDev/Include/EGkPolyLine.h" #include "/EgtDev/Include/EGkPlane3d.h" #include "/EgtDev/Include/EGkStringUtils3d.h" @@ -223,6 +224,14 @@ Triangulate::Make( const POLYLINEVECTOR& vPL, PNTVECTOR& vPt, INTVECTOR& vTr) //--------------------------------------------------------------------------- bool Triangulate::MakeAdvanced( const POLYLINEVECTOR& vPLORIG, PNTVECTOR& vPt, INTVECTOR& vTr) +{ + INTMATRIX vnPLIndMat ; + return MakeAdvanced( vPLORIG, vPt, vTr, vnPLIndMat) ; +} + +//--------------------------------------------------------------------------- +bool +Triangulate::MakeAdvanced( const POLYLINEVECTOR& vPLORIG, PNTVECTOR& vPt, INTVECTOR& vTr, const INTMATRIX& vnPLIndMatPre) { vPt.clear() ; vTr.clear() ; @@ -230,113 +239,27 @@ Triangulate::MakeAdvanced( const POLYLINEVECTOR& vPLORIG, PNTVECTOR& vPt, INTVEC if ( int( vPLORIG.size()) == 0) return true ; - // copio il vettore di PolyLine POLYLINEVECTOR vPL ; - for ( int i = 0 ; i < int( vPLORIG.size()) ; ++ i) - vPL.push_back( vPLORIG[i]) ; - - typedef std::pair INDAREA ; - std::vector m_vArea ; - // calcolo piano medio e area delle curve - m_vArea.reserve( vPL.size()) ; - Vector3d vtN0 ; - for ( int i = 0 ; i < int( vPL.size()) ; ++ i) { - // calcolo piano medio e area - Plane3d plPlane ; - double dArea ; - if ( ! vPL[i].IsClosedAndFlat( plPlane, dArea)) - return false ; - // imposto la normale del primo contorno come riferimento - if ( i == 0) - vtN0 = plPlane.GetVersN() ; - // verifico che le normali siano molto vicine - if ( ! AreSameOrOppositeVectorApprox( plPlane.GetVersN(), vtN0)) - return false ; - // assegno il segno all'area secondo il verso della normale - if ( ( plPlane.GetVersN() * vtN0) > 0) - m_vArea.emplace_back( i, dArea) ; - else - m_vArea.emplace_back( i, - dArea) ; - } - // ordino in senso decrescente sull'area - sort( m_vArea.begin(), m_vArea.end(), - []( const INDAREA& a, const INDAREA& b) { return ( abs( a.second) > abs( b.second)) ; }) ; - - // dalle PolyLine passo alle curve nel piano XY ( prendo la prima come riferimento, trascuro le Z delle successive) - Frame3d frRef ; frRef.Set( ORIG, vtN0) ; - if ( ! frRef.IsValid()) - return false ; - ICRVCOMPOPOVECTOR vCrvCompo( int( vPL.size())) ; - for ( int i = 0 ; i < int( vPL.size()) ; ++ i) { - vCrvCompo[i].Set( CreateCurveComposite()) ; - vCrvCompo[i]->FromPolyLine( vPL[i]) ; - vCrvCompo[i]->ToLoc( frRef) ; - } - - // creo una matrice di interi ; ogni riga corrisponde ad un chunk, dove in posizione 0 c'è il loop esterno e nelle - // successive i loop interni + Vector3d vtN ; + // se non sono stati passate le info per ordinare le polyline allora le ordino INTMATRIX vnPLIndMat ; + if( vnPLIndMatPre.size() == 0){ + if ( ! CalcRegionPolyLines( vPLORIG, vPL, vtN, vnPLIndMat)) + return false ; + } + else { + //for ( int i = 0 ; i < int( vnPLIndMat.size()) ; ++i) { + // for ( int j = 0 ; j < int( vnPLIndMat[i].size()) ; ++j ) { + // vPL.push_back( vPLORIG[vnPLIndMat[i][j]]) ; + // if( vbInvert[vnPLIndMat[i][j]]) + // vPL.back().Invert() ; + // } + //} - // aggiungo le diverse curve - bool bFirstCrv ; - Plane3d plExtLoop ; - double dAreaExtLoop = 0. ; - do { - bFirstCrv = true ; - for ( int i = 0 ; i < int( m_vArea.size()) ; ++ i) { - // recupero indice di percorso e verifico sia valido - int j = m_vArea[i].first ; - if ( j < 0) - continue ; - // lo inserisco come esterno... - if ( bFirstCrv) { - vnPLIndMat.push_back({ j}) ; - m_vArea[i].first = -1 ; - dAreaExtLoop = m_vArea[i].second ; - // inverto se necessario - if ( m_vArea[i].second < EPS_SMALL) { - vPL[j].Invert() ; - vCrvCompo[j]->Invert() ; - dAreaExtLoop *= -1 ; - } - bFirstCrv = false ; - } - // ... altrimenti verifico se il loop è interno o no - else { - // il loop è interno se è sia interno al loop esterno della riga di vnPLIndMat e allo stesso tempo - // esterno a tutti i loop già inseriti nella riga attuale. - // verifica rispetto loop esterno - IntersCurveCurve ccInt( *vCrvCompo[vnPLIndMat.back().front()], *vCrvCompo[j]) ; - CRVCVECTOR ccClass ; - if ( ccInt.GetCrossOrOverlapIntersCount() > 0 || - ! ccInt.GetCurveClassification( 1, EPS_SMALL, ccClass) || - ccClass.empty() || ccClass[0].nClass != CRVC_IN) - continue ; - // verifica rispetto ai loop interni - bool bOk = true ; - for ( int k = 1 ; k < int( vnPLIndMat.back().size()) ; ++ k) { - IntersCurveCurve ccInt2( *vCrvCompo[vnPLIndMat.back()[k]], *vCrvCompo[j]) ; - CRVCVECTOR ccClass2 ; - if ( ccInt2.GetCrossOrOverlapIntersCount() > 0 || - ! ccInt2.GetCurveClassification( 1, EPS_SMALL, ccClass2) || - ccClass2.empty() || ccClass2[0].nClass != CRVC_IN) { - bOk = false ; - break ; - } - } - if ( bOk) { - // inserisco nella matrice - vnPLIndMat.back().push_back( j) ; - m_vArea[i].first = -1 ; - // inverto se necessario - if ( m_vArea[i].second * dAreaExtLoop > 0.) { - vPL[j].Invert() ; - vCrvCompo[j]->Invert() ; - } - } - } - } - } while ( ! bFirstCrv) ; + // ho gi� calcolato e riordinato tutto, devo solo fare una copia delle polyline + vPL = vPLORIG ; + vnPLIndMat = vnPLIndMatPre ; + } // chiamo la Triangolazione per ogni riga della matrice ( quindi su ogni "Chunk") for ( int i = 0 ; i < int( vnPLIndMat.size()) ; ++ i) { @@ -525,7 +448,7 @@ Triangulate::MakeByEC( const PNTVECTOR& vPt, INTVECTOR& vTr) vTr.push_back( vPol[i]) ; vTr.push_back( vPol[vNext[i]]) ; } - // ‘Delete’ vertex v[i] by redirecting next and previous links + // �Delete� vertex v[i] by redirecting next and previous links // of neighboring verts past it. Decrement vertex count vNext[vPrev[i]] = vNext[i] ; vPrev[vNext[i]] = vPrev[i] ; @@ -654,7 +577,7 @@ Triangulate::MakeByEC2( const PNTVECTOR& vPt, INTVECTOR& vTr, double& dMinMinAng // Reset earity of diagonal endpoints vEar[vPrev[i]] = EAS_NULL ; vEar[vNext[i]] = EAS_NULL ; - // ‘Delete’ vertex v[i] by redirecting next and previous links + // �Delete� vertex v[i] by redirecting next and previous links // of neighboring verts past it. Decrement vertex count vNext[vPrev[i]] = vNext[i] ; vPrev[vNext[i]] = vPrev[i] ; @@ -792,7 +715,7 @@ Triangulate::MakeByEC3( const PNTVECTOR& vPt, INTVECTOR& vTr, double& dMinMinAng // Reset earity of diagonal endpoints vEar[vPrev[i]] = EAS_NULL ; vEar[vNext[i]] = EAS_NULL ; - // ‘Delete’ vertex v[i] by redirecting next and previous links + // �Delete� vertex v[i] by redirecting next and previous links // of neighboring verts past it. Decrement vertex count vNext[vPrev[i]] = vNext[i] ; vPrev[vNext[i]] = vPrev[i] ; @@ -886,7 +809,7 @@ Triangulate::TestTriangle( const PNTVECTOR& vPt, const INTVECTOR& vPol, } } else { - // The ‘ear’ triangle is clockwise so v[i] is not an ear + // The �ear� triangle is clockwise so v[i] is not an ear bIsEar = false ; } @@ -1231,14 +1154,14 @@ Triangulate::GetOuterPntToJoin( const PNTVECTOR& vPt, const Point3d& ptP, int& n break ; } } - // non ho trovato alcunché, errore + // non ho trovato alcunch�, errore if ( nI == - 1) return false ; // se ho trovato un punto esatto del contorno, non devo fare altri controlli if ( AreSamePointApprox( ptInt, vPt[nI])) return true ; // devo ora verificare che il segmento che unisce i punti non intersechi altri lati del contorno esterno - // altrimenti tengo il punto con raggio più vicino a X_AX o Y_AX o Z_AX secondo m_nPlane + // altrimenti tengo il punto con raggio pi� vicino a X_AX o Y_AX o Z_AX secondo m_nPlane int nJ = nI ; Point3d ptPa = ptP ; Point3d ptPb = vPt[nI] ; @@ -1254,7 +1177,7 @@ Triangulate::GetOuterPntToJoin( const PNTVECTOR& vPt, const Point3d& ptP, int& n double dMinTan = INFINITO ; double dMinSqDist = SQ_INFINITO ; for ( int i = 0 ; i < nNumPt ; ++ i) { - // salto il punto già trovato + // salto il punto gi� trovato if ( i == nJ) continue ; // verifico se sta nel triangolo @@ -1290,7 +1213,7 @@ Triangulate::GetOuterPntToJoin( const PNTVECTOR& vPt, const Point3d& ptP, int& n bool Triangulate::PointInSector( const Point3d& ptTest, const Point3d& ptPrev, const Point3d& ptCorn, const Point3d& ptNext) { - // la parte valida del settore è a sinistra dei segmenti ptPrev --> ptCorn --> ptNext + // la parte valida del settore � a sinistra dei segmenti ptPrev --> ptCorn --> ptNext // se corner convesso if ( TriangleIsCCW( ptPrev, ptCorn, ptNext, 0)) return ( TriangleIsCCW( ptPrev, ptCorn, ptTest) && @@ -1305,10 +1228,10 @@ Triangulate::PointInSector( const Point3d& ptTest, const Point3d& ptPrev, const bool ChangeStartPntVector( int nNewStart, PNTVECTOR& vPi) { - // se il nuovo inizio coincide col vecchio, non devo fare alcunché + // se il nuovo inizio coincide col vecchio, non devo fare alcunch� if ( nNewStart == 0) return true ; - // se il nuovo indice è oltre la dimensione del vettore, errore + // se il nuovo indice � oltre la dimensione del vettore, errore if ( nNewStart >= int( vPi.size())) return false ; // ciclo di aggiustamento diff --git a/Triangulate.h b/Triangulate.h index 5c6054a..7145157 100644 --- a/Triangulate.h +++ b/Triangulate.h @@ -23,6 +23,7 @@ class Triangulate bool Make( const PolyLine& PL, PNTVECTOR& vPt, INTVECTOR& vTr) ; bool Make( const POLYLINEVECTOR& vPL, PNTVECTOR& vPt, INTVECTOR& vTr) ; bool MakeAdvanced( const POLYLINEVECTOR& vPL, PNTVECTOR& vPt, INTVECTOR& vTr) ; + bool MakeAdvanced( const POLYLINEVECTOR& vPL, PNTVECTOR& vPt, INTVECTOR& vTr, const INTMATRIX& vnPLIndMat) ; private : bool MakeByEC_HPP( const PolyLine& PL, bool bCCW, PNTVECTOR& vPt, INTVECTOR& vTr) ;