diff --git a/CalcPocketing.cpp b/CalcPocketing.cpp index 2c2fd39..c6dc49e 100644 --- a/CalcPocketing.cpp +++ b/CalcPocketing.cpp @@ -85,11 +85,43 @@ typedef vector VICRVCOMPOPOVECTOR ; #include "EgtDev/Include/EGkGeoObjSave.h" #include "EgtDev/Include/EGkGeoPoint3d.h" #include "EgtDev/Include/EGkGeoVector3d.h" + + // Varibili ausiliarie vector VT ; vector VC ; + + //--------------------------------------------------------------------------- inline Color GetRandomColor() { return Color( double( rand()) / RAND_MAX, double( rand()) / RAND_MAX, double( rand()) / RAND_MAX, 1.) ; } + + //--------------------------------------------------------------------------- + inline void DrawCurve( const ICurveComposite* pCrvCompo) { + if ( pCrvCompo == nullptr || ! pCrvCompo->IsValid()) + return ; + for ( int nU = 0 ; nU < pCrvCompo->GetCurveCount() ; ++ nU) { + int nProp0 ; pCrvCompo->GetCurveTempProp( nU, nProp0, 0) ; + VT.emplace_back( static_cast( pCrvCompo->GetCurve( nU)->Clone())) ; + VC.emplace_back( nProp0 == 0 ? BLUE : RED) ; + } + return ; + } + + //--------------------------------------------------------------------------- + inline void DrawSfrAndLoops( const ISurfFlatRegion* pSfr, Color cCol = Color( 0., 255., 0., .5)) { + if ( pSfr == nullptr || ! pSfr->IsValid()) + return ; + VT.emplace_back( static_cast( pSfr->Clone())) ; + VC.emplace_back( cCol) ; + for ( int nC = 0 ; nC < pSfr->GetChunkCount() ; ++ nC) { + for ( int nL = 0 ; nL < pSfr->GetLoopCount( nC) ; ++ nL) { + PtrOwner pCrvCompo( ConvertCurveToComposite( pSfr->GetLoop( nC, nL))) ; + DrawCurve( pCrvCompo->Clone()) ; + } + } + return ; + } + #endif //--------------------------------------------------------------------------- diff --git a/SurfTriMesh.cpp b/SurfTriMesh.cpp index 87e5ffb..21c4386 100644 --- a/SurfTriMesh.cpp +++ b/SurfTriMesh.cpp @@ -1220,16 +1220,17 @@ SurfTriMesh::GetSilhouette( const Plane3d& plPlane, double dTol, POLYLINEVECTOR& // se rimasto qualcosa if ( pgTria.GetSideCount() > 0) { // lo proietto sul piano e creo la regione - pgTria.Scale( frOCS, 1, 1, 0) ; - PtrOwner pSfrTria( GetBasicSurfFlatRegion( GetSurfFlatRegionFromPolyLine( pgTria.GetPolyLine()))) ; - if ( ! IsNull( pSfrTria)) { - if ( bAllTria && Tria.GetN() * vtVers < 0) - pSfrTria->Invert() ; - pSfrTria->Offset( dTol, ICurve::OFF_FILLET) ; - if ( IsNull( pSfr)) - pSfr.Set( pSfrTria) ; - else - pSfr->Add( *pSfrTria) ; + if ( pgTria.Scale( frOCS, 1, 1, 0)) { + PtrOwner pSfrTria( GetBasicSurfFlatRegion( GetSurfFlatRegionFromPolyLine( pgTria.GetPolyLine()))) ; + if ( ! IsNull( pSfrTria)) { + if ( bAllTria && Tria.GetN() * vtVers < 0) + pSfrTria->Invert() ; + pSfrTria->Offset( dTol, ICurve::OFF_FILLET) ; + if ( IsNull( pSfr)) + pSfr.Set( pSfrTria) ; + else + pSfr->Add( *pSfrTria) ; + } } } }