EgtGeomKernel :

- Modifica Medial Axis.
This commit is contained in:
Riccardo Elitropi
2022-12-15 16:24:58 +01:00
parent ffc78b03a7
commit bd80f16812
+19
View File
@@ -23,6 +23,11 @@
#include "/EgtDev/Include/EGkIntersCurves.h"
#include "/EgtDev/Include/EGkMedialAxis.h"
#include <EgtDev/Include/EGnStringUtils.h>
using namespace std ;
//----------------------------------------------------------------------------
@@ -30,6 +35,7 @@ static bool
ProcessCircleCurve( const Point3d& ptCen, double dDiam, const CurveComposite& crvCompo,
PNTVECTOR& vPnt, DBLVECTOR& vDiam)
{
// pulizia risultati
vPnt.clear() ;
vDiam.clear() ;
@@ -42,8 +48,13 @@ ProcessCircleCurve( const Point3d& ptCen, double dDiam, const CurveComposite& cr
if ( ! LnCmpInt.GetCurveClassification( 0, 10 * EPS_SMALL, ccClass))
return false ;
int nCount = int( ccClass.size()) ;
// ... per evitare percorsi di ritorno
int nInparts = 0 ;
for ( int i = 0 ; i < nCount ; ++ i) {
if ( ccClass[i].nClass == CRVC_IN) {
nInparts ++ ;
// gestione unione intervallo a cavallo del parametro 0==1
if ( i == nCount - 1 && ccClass[0].nClass == CRVC_IN && ccClass[0].dParS < EPS_ZERO && ccClass[i].dParE > 1 - EPS_ZERO) {
double dPar = ( ccClass[i].dParS + 1 + ccClass[0].dParE) / 2 ;
@@ -54,6 +65,7 @@ ProcessCircleCurve( const Point3d& ptCen, double dDiam, const CurveComposite& cr
vPnt[0] = ptP ;
double dDelta = ccClass[i].dParE - ccClass[i].dParS + ccClass[0].dParE - ccClass[0].dParS ;
vDiam[0] = PIGRECO * dDiam * dDelta ;
nInparts-- ;
}
// altrimenti caso standard
else {
@@ -66,6 +78,10 @@ ProcessCircleCurve( const Point3d& ptCen, double dDiam, const CurveComposite& cr
}
}
}
if ( nInparts == 1)
vPnt.clear() ;
return true ;
}
@@ -135,6 +151,7 @@ CurveSimpleMedialAxis( const ICurve* pCrv, PolyLine& PL)
Point3d ptP2 = ptP1 + 1.2 * b3Compo.GetDimX() * X_AX ;
crvLine.Set( ptP1, ptP2) ;
}
IntersCurveCurve LnCmpInt( crvLine, crvCompo) ;
if ( LnCmpInt.GetCrossIntersCount() < 2)
return false ;
@@ -152,6 +169,7 @@ CurveSimpleMedialAxis( const ICurve* pCrv, PolyLine& PL)
double dDiam = dDiamOrig ;
Vector3d vtDir = vtDirOrig ;
int i = 0 ;
while ( i < 1000) {
PNTVECTOR vPnt ;
DBLVECTOR vDiam ;
@@ -180,6 +198,7 @@ CurveSimpleMedialAxis( const ICurve* pCrv, PolyLine& PL)
PL.AddUPoint( 0, GetToGlob( ptStart, frLoc)) ;
++ i ;
}
// movimento lungo l'altro ramo
ptStart = ptOrig ;
dDiam = dDiamOrig ;