From 1e671d031f976ac5d201012dcb5ea65aa3e59b37 Mon Sep 17 00:00:00 2001 From: Daniele Bariletti Date: Fri, 7 Aug 2026 16:18:16 +0200 Subject: [PATCH] EgtGeomKernel : - correzione alla ruled smooth - correzione all'offset3d. --- OffsetCurve3d.cpp | 8 ++++++-- SurfBezier.cpp | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/OffsetCurve3d.cpp b/OffsetCurve3d.cpp index 5bdb6fb..b8d96b7 100644 --- a/OffsetCurve3d.cpp +++ b/OffsetCurve3d.cpp @@ -201,6 +201,7 @@ OffsetCurve3d::Make( const PNT5AXVECTOR& vPnt5Ax, double dOffDist, int nType) int nClosure = bClosed ? 1 : 0 ; bool bCheckingClosure = false ; bool bPlanarConcCvex = false ; + bool bPrevTwoPointsWereConvex = false ; for ( int i = 1 ; i <= pCrv->GetCurveCount() + nClosure ; ++i) { int nCurr = i ; int nPrev = i - 1 ; @@ -224,7 +225,7 @@ OffsetCurve3d::Make( const PNT5AXVECTOR& vPnt5Ax, double dOffDist, int nType) // negli altri casi faccio la media if ( vFlag[nCurr] != OffsetCurve3d::AngType::ANG_CVEX) vtTang = Media( vtDirCurr, vtDirPrev) ; - else if ( vFlag[nCurr] == OffsetCurve3d::AngType::ANG_CVEX && vFlag[nPrev] != OffsetCurve3d::AngType::ANG_CVEX) + else if ( vFlag[nCurr] == OffsetCurve3d::AngType::ANG_CVEX && ( vFlag[nPrev] != OffsetCurve3d::AngType::ANG_CVEX || bPrevTwoPointsWereConvex)) vtTang = vtDirPrev ; else vtTang = vtDirCurr ; @@ -244,7 +245,7 @@ OffsetCurve3d::Make( const PNT5AXVECTOR& vPnt5Ax, double dOffDist, int nType) dRadCorr = dOffDist ; ptP = ptP + dRadCorr * dCorrK * vtCorr ; // se secondo punto di angolo esterno di fianco, inserisco movimenti intermedi - if ( vFlag[nCurr] == OffsetCurve3d::AngType::ANG_CVEX && vFlag[nPrev] == OffsetCurve3d::AngType::ANG_CVEX && bPlanarConcCvex) { + if ( vFlag[nCurr] == OffsetCurve3d::AngType::ANG_CVEX && vFlag[nPrev] == OffsetCurve3d::AngType::ANG_CVEX && ! bPrevTwoPointsWereConvex && bPlanarConcCvex) { double dAlfa = acos( vtTang * vtTangPrev) ; double dDelta = dOffDist * tan( dAlfa / 4) ; Point3d ptAdd1 = ptPrev + dDelta * vtTangPrev ; @@ -256,7 +257,10 @@ OffsetCurve3d::Make( const PNT5AXVECTOR& vPnt5Ax, double dOffDist, int nType) pCL2->Set( ptAdd1, ptAdd2) ; vOffsetCrvs.emplace_back( pCL2, OffsetCurve3d::AngType::ANG_CVEX, -1) ; ptPrev = ptAdd2 ; + bPrevTwoPointsWereConvex = true ; } + else + bPrevTwoPointsWereConvex = false ; Vector3d vtAng = vtDirPrev ^ vtDirCurr ; const double COS_ANG_MAX_PLANAR = 0.7 ; bPlanarConcCvex = false ; diff --git a/SurfBezier.cpp b/SurfBezier.cpp index 6df7a70..39df49d 100644 --- a/SurfBezier.cpp +++ b/SurfBezier.cpp @@ -6280,7 +6280,7 @@ ManageTwistInQuadrangulation( const ICurveComposite* pSubEdge1, const ICurveComp double dU0 ; pSubEdge1->GetParamAtPoint( vSyncLines.end()[-2].first, dU0, TOL) ; double dU1 ; pSubEdge1->GetParamAtPoint( vSyncLines.end()[-1].first, dU1, TOL) ; if ( dU0 > dU1 - EPS_SMALL) - swap( vSyncLines.end()[-2], vSyncLines[-1]) ; + swap( vSyncLines.end()[-2], vSyncLines.end()[-1]) ; // Verifico che le curve non si intreccino pSubEdge2->GetParamAtPoint( vSyncLines.end()[-2].second, dU0, TOL) ; pSubEdge2->GetParamAtPoint( vSyncLines.end()[-1].second, dU1, TOL) ;