//---------------------------------------------------------------------------- // EgalTech 2023-2023 //---------------------------------------------------------------------------- // File : ProjectCurveSurfTm.cpp Data : 31.08.23 Versione : 2.5h3 // Contenuto : Implementazione funzioni proiezione curve su superficie Trimesh. // // // // Modifiche : 31.08.23 DS Creazione modulo. // // //---------------------------------------------------------------------------- //--------------------------- Include ---------------------------------------- #include "stdafx.h" #include "GeoConst.h" #include "/EgtDev/Include/EGkIntersLineSurfTm.h" #include "/EgtDev/Include/EGkProjectCurveSurfTm.h" //---------------------------------------------------------------------------- bool ProjectCurveOnSurfTm( const ICurve& crCrv, const ISurfTriMesh& tmSurf, const Vector3d& vtDir, double dLinTol, PNT5AXVECTOR& vPt5ax) { // approssimo la curva con una polilinea entro la metà della tolleranza PolyLine PL ; if ( ! crCrv.ApproxWithLines( dLinTol, ANG_TOL_STD_DEG, ICurve::APL_STD, PL)) return false ; const double MAX_SEG_LEN = 10 ; if ( ! PL.AdjustForMaxSegmentLen( MAX_SEG_LEN)) return false ; // Oggetto per calcolo massivo intersezioni tra linee di proiezione e superficie Frame3d frRefLine ; if ( ! frRefLine.Set( ORIG, vtDir)) return false ; IntersParLinesSurfTm intPLSTM( frRefLine, tmSurf) ; // Riservo spazio nel vettore risultato vPt5ax.reserve( PL.GetPointNbr()) ; // proietto i punti della polilinea sulla superficie double dU ; Point3d ptP ; bool bFound = PL.GetFirstUPoint( &dU, &ptP) ; while ( bFound) { Point3d ptL = GetToLoc( ptP, frRefLine) ; ILSIVECTOR vIntRes ; intPLSTM.GetInters( ptL, 1, vIntRes, false) ; if ( vIntRes.size() > 0) { int nI = int( vIntRes.size()) - 1 ; Point3d ptInt ; if ( vIntRes[nI].nILTT == ILTT_SEGM || vIntRes[nI].nILTT == ILTT_SEGM_ON_EDGE) ptInt = vIntRes[nI].ptI2 ; else ptInt = vIntRes[nI].ptI ; Triangle3d trTria ; if ( ! tmSurf.GetTriangle( vIntRes[nI].nT, trTria)) return false ; vPt5ax.emplace_back( ptInt, trTria.GetN(), dU, 1) ; } bFound = PL.GetNextUPoint( &dU, &ptP) ; } return true ; }