From 2dcaa57aa3b383795996860df2ca18e8e21163a4 Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Thu, 14 May 2026 13:02:47 +0200 Subject: [PATCH] =?UTF-8?q?EgtGeomKernel=20:=20-=20modifiche=20a=20RMF=20p?= =?UTF-8?q?er=20avere=20la=20tangente=20media=20sul=20punto=20di=20calcolo?= =?UTF-8?q?=20(utile=20solo=20se=20la=20curva=20non=20=C3=A8=20G1)=20-=20m?= =?UTF-8?q?odifiche=20a=20GetSurfTriMeshSwept=20per=20avere=20RMF=20anche?= =?UTF-8?q?=20con=20curve=20piane=20garantendo=20la=20retrocompatibilit?= =?UTF-8?q?=C3=A0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- RotationMinimizingFrame.cpp | 13 ++++++++++--- StmFromCurves.cpp | 6 +++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/RotationMinimizingFrame.cpp b/RotationMinimizingFrame.cpp index cbb878c..c81d7dc 100644 --- a/RotationMinimizingFrame.cpp +++ b/RotationMinimizingFrame.cpp @@ -92,11 +92,18 @@ RotationMinimizingFrame::GetFrameAtParam( const Frame3d& frAct, const double dPa Vector3d vtCurrR = frAct.VersX() ; Vector3d vtCurrT = frAct.VersZ() ; - // punto i-esimo sulla curva e suo vettore tangente + // punto i-esimo sulla curva e suo vettore tangente medio + Point3d ptNextM, ptNextP ; + Vector3d vtNextM, vtNextP ; + if ( ! m_pCrv->GetPointD1D2( dParNext, ICurve::FROM_MINUS, ptNextM, &vtNextM) || + ! m_pCrv->GetPointD1D2( dParNext, ICurve::FROM_PLUS, ptNextP, &vtNextP) || + ! vtNextM.Normalize() || ! vtNextP.Normalize()) + return false ; Point3d ptNext ; Vector3d vtNextT ; - if ( ! m_pCrv->GetPointD1D2( dParNext, ICurve::FROM_MINUS, ptNext, &vtNextT) || - ! vtNextT.Normalize()) + ptNext = Media( ptNextM, ptNextP) ; + vtNextT = Media( vtNextM, vtNextP) ; + if ( ! vtNextT.Normalize()) return false ; // controllo per casi degeneri diff --git a/StmFromCurves.cpp b/StmFromCurves.cpp index 8ccb23d..3ffa6ee 100644 --- a/StmFromCurves.cpp +++ b/StmFromCurves.cpp @@ -1095,7 +1095,7 @@ GetSurfTriMeshSwept3d( const ICurve* pSect, const ICurve* pGuide, const Vector3d // determino se la guida è chiusa bool bGuideClosed = pGuide->IsClosed() ; // determino algoritmo da usare per calcolare i riferimenti lungo la curva - bool bRMF = vtAx.IsSmall() ; + bool bRMF = ( ! vtAx.IsValid() || vtAx.IsSmall()) ; // riferimento all'inizio della linea guida Point3d ptStart ; @@ -1242,9 +1242,9 @@ GetSurfTriMeshSwept( const ICurve* pSect, const ICurve* pGuide, const Vector3d& if ( pCompo != nullptr && pCompo->IsALine( 10 * EPS_SMALL, ptStart, ptEnd)) bIsLine = true ; } - // se la guida è piana + // se la guida è piana e il vettore di riferimento è non definito oppure non nullo Plane3d plGuide ; - if ( pGuide->IsFlat( plGuide, bIsLine, 10 * EPS_SMALL)) + if ( pGuide->IsFlat( plGuide, bIsLine, 10 * EPS_SMALL) && ( ! vtAx.IsValid() || ! vtAx.IsSmall())) return GetSurfTriMeshSweptInPlane( pSect, pGuide, plGuide.GetVersN(), bCapEnds, dLinTol) ; // altrimenti swept 3d