EgtGeomKernel :

- Aggiunto controllo sulla scalatura nella funzione GetSilhouette in SurfTriMesh
- In CalcPocketing, aggiunte funzioni ausiliarie per Debug.
This commit is contained in:
Riccardo Elitropi
2025-05-29 11:52:19 +02:00
parent e185c85d5e
commit fa680b7799
2 changed files with 43 additions and 10 deletions
+32
View File
@@ -85,11 +85,43 @@ typedef vector<ICRVCOMPOPOVECTOR> VICRVCOMPOPOVECTOR ;
#include "EgtDev/Include/EGkGeoObjSave.h"
#include "EgtDev/Include/EGkGeoPoint3d.h"
#include "EgtDev/Include/EGkGeoVector3d.h"
// Varibili ausiliarie
vector<IGeoObj*> VT ;
vector<Color> 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<IGeoObj*>( 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<IGeoObj*>( pSfr->Clone())) ;
VC.emplace_back( cCol) ;
for ( int nC = 0 ; nC < pSfr->GetChunkCount() ; ++ nC) {
for ( int nL = 0 ; nL < pSfr->GetLoopCount( nC) ; ++ nL) {
PtrOwner<ICurveComposite> pCrvCompo( ConvertCurveToComposite( pSfr->GetLoop( nC, nL))) ;
DrawCurve( pCrvCompo->Clone()) ;
}
}
return ;
}
#endif
//---------------------------------------------------------------------------
+11 -10
View File
@@ -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<SurfFlatRegion> 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<SurfFlatRegion> 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) ;
}
}
}
}