This commit is contained in:
Riccardo Elitropi
2025-05-05 12:25:16 +02:00
2 changed files with 14 additions and 4 deletions
+5 -2
View File
@@ -502,8 +502,9 @@ CurveByApprox::BiArcOrSplit( int nLev, PolyLine& PL, double dLinTol, double dAng
m_vPrevDer[nI].ToSpherical( nullptr, nullptr, &dDir1Deg) ;
// costruisco un biarco sulla polilinea (secondo metodo di Z. Sir)
pCrv.Set( GetBiArc( ptP0, dDir0Deg, ptP1, dDir1Deg, PL, dMaxDist, dLinTol)) ;
// forzo la spezzatura della curva
if ( IsNull( pCrv))
return false ;
dMaxDist = 2 * dLinTol ;
}
// se la polilinea è formata da 2 punti
else if ( PL.GetPointNbr() == 2) {
@@ -524,13 +525,15 @@ CurveByApprox::BiArcOrSplit( int nLev, PolyLine& PL, double dLinTol, double dAng
// se raggiunto il massimo livello di recursione, forzo l'accettazione del biarco
if ( nLev >= MAX_LEV) {
if ( IsNull( pCrv))
return false ;
dMaxDist = 0 ;
// segnalo situazione per debug
if ( GetEGkDebugLev() >= 5)
LOG_DBG_ERR( GetEGkLogger(), "ERROR : Exceeded recursions")
}
// se lunghezza abbastanza picccola, forzo l'accettazione della curva
// se lunghezza abbastanza piccola, forzo l'accettazione della curva
double dLen ;
if ( PL.GetApproxLength( dLen) && dLen < 10 * EPS_SMALL)
dMaxDist = 0 ;
+9 -2
View File
@@ -3264,11 +3264,12 @@ MergeTwoCurves( ICurve* pCrvP, ICurve* pCrvC, double& dCurrLinTol, double dCosAn
if ( ! bPlaneArcs) {
ptP1.Scale( frRef, 1, 1, 0) ;
ptP2.Scale( frRef, 1, 1, 0) ;
ptP3.Scale( frRef, 1, 1, 0) ;
ptP3.Scale( frRef, 1, 1, 0) ;
ptC1Fin.Scale( frRef, 1, 1, 0) ;
}
// verifico se circonferenza completa
bool bCirc = ( AreSamePointApprox( ptP1, ptP3)) ;
bool bCirc = ( AreSamePointEpsilon( ptP1, ptP3, dCurrLinTol)) ;
if ( bCirc) {
pArcC->GetMidPoint( ptP3) ;
if ( ! bPlaneArcs)
@@ -3277,6 +3278,12 @@ MergeTwoCurves( ICurve* pCrvP, ICurve* pCrvC, double& dCurrLinTol, double dCosAn
CurveArc NewArc ;
if ( NewArc.Set3P( ptP1, ptP2, ptP3, bCirc)) {
// se vicino a circonferenza arco per 3 punti potrebbe non dare il risultato desiderato quindi faccio controllo su raggio e centro
double dDist = Dist( NewArc.GetCenter(), ptC1Fin) ;
double dDelta = abs( NewArc.GetRadius() - pArcP->GetRadius()) ;
if ( Dist( NewArc.GetCenter(), ptC1Fin) > 2 * dCurrLinTol || abs( NewArc.GetRadius() - pArcP->GetRadius()) > 2 * dCurrLinTol)
return 0 ;
// verifico normale al piano dell'arco
if ( NewArc.GetNormVersor() * pArcC->GetNormVersor() < 0)
NewArc.InvertN() ;