From f43951a9e2adbdd1ac3bf0a37b2a4819aaebcfda Mon Sep 17 00:00:00 2001 From: DarioS Date: Sun, 20 Feb 2022 19:31:03 +0100 Subject: [PATCH] =?UTF-8?q?EgtGeomKernel=202.4b2=20:=20-=20in=20chiusura?= =?UTF-8?q?=20di=20Curva=20Composita=20con=20estremi=20pi=C3=B9=20vicini?= =?UTF-8?q?=20di=2010*EPS=5FSMALL=20si=20spostano=20gli=20estremi=20a=20me?= =?UTF-8?q?t=C3=A0=20strada=20-=20in=20creazione=20FlatRegion=20da=20FatCu?= =?UTF-8?q?rve=20migliorata=20gestione=20curve=20quasi=20chiuse.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CurveComposite.cpp | 21 ++++++++++++++++----- EgtGeomKernel.rc | Bin 11718 -> 11718 bytes SfrCreate.cpp | 23 +++++++++++++++-------- 3 files changed, 31 insertions(+), 13 deletions(-) diff --git a/CurveComposite.cpp b/CurveComposite.cpp index 423d9f5..cff3ca5 100644 --- a/CurveComposite.cpp +++ b/CurveComposite.cpp @@ -255,14 +255,25 @@ CurveComposite::Close( void) // se già chiusa, non faccio alcunché if ( IsClosed()) return true ; - // aggiungo la linea di chiusura - PtrOwner pLine( CreateBasicCurveLine()) ; + // determino la distanza tra gli estremi Point3d ptStart, ptEnd ; if ( ! GetStartPoint( ptStart) || - ! GetEndPoint( ptEnd) || - ! pLine->Set( ptEnd, ptStart) || - ! AddSimpleCurve( Release( pLine))) + ! GetEndPoint( ptEnd)) return false ; + // se molto vicini li modifico + if ( SqDist( ptStart, ptEnd) < 100 * SQ_EPS_SMALL) { + Point3d ptMid = Media( ptStart, ptEnd) ; + if ( ! ModifyStart( ptMid) || + ! ModifyEnd( ptMid)) + return false ; + } + // altrimenti aggiungo la linea di chiusura + else { + PtrOwner pLine( CreateBasicCurveLine()) ; + if ( ! pLine->Set( ptEnd, ptStart) || + ! AddSimpleCurve( Release( pLine))) + return false ; + } // imposto ricalcolo della grafica m_OGrMgr.Reset() ; diff --git a/EgtGeomKernel.rc b/EgtGeomKernel.rc index 05809858f7a78fc911901a9b8872dfafb2e440cb..08bfb16683a946f8503b280f8d3c552dfb5ecca3 100644 GIT binary patch delta 100 zcmX>WeJpyzFE&P_&G*I5Gfl4J(wY2?Q;pGRvLd(cW-qP@EMOU1W|)YS2jk{G;Q$~X Qr~yeBsu05nEu}f!0J&5j?f?J) delta 100 zcmX>WeJpyzFE&QQ&G*I5Gfl4J(wY2?Q;pGZvLd(cW-qP@EMOU1W|)YS2jk{G;Q$~X Qr~yeBsu05nEu}f!0Jpp!<^TWy diff --git a/SfrCreate.cpp b/SfrCreate.cpp index d21c5ac..6c588f9 100644 --- a/SfrCreate.cpp +++ b/SfrCreate.cpp @@ -136,14 +136,21 @@ GetSurfFlatRegionFromFatCurve( ICurve* pCrv, double dRadius, bool bSquareEnds, b pCompo1->GetEndPoint( ptEnd) ; pCompo1->GetEndDir( vtEnd) ; pCompo1->GetMidPoint( ptMid) ; - if ( Dist( ptStart, ptEnd) <= 2 * dRadius && Dist( ptStart, ptMid) > 2 * dRadius && Dist( ptEnd, ptMid) > 2 * dRadius) { - double dAngEnd ; vtEnd.ToSpherical( nullptr, nullptr, &dAngEnd) ; - double dAngStart ; vtStart.ToSpherical( nullptr, nullptr, &dAngStart) ; - PtrOwner pClose( GetBiArc( ptEnd, dAngEnd, ptStart, dAngStart, 0.5)) ; - if ( ! IsNull( pClose)) - pCompo1->AddCurve( Release( pClose)) ; - else - pCompo1->Close() ; + if ( AreSamePointEpsilon( ptStart, ptEnd, 2 * dRadius) && Dist( ptStart, ptMid) > 2 * dRadius && Dist( ptEnd, ptMid) > 2 * dRadius) { + if ( AreSamePointEpsilon( ptStart, ptEnd, max( 0.1 * dRadius, 10 * EPS_SMALL))) { + Point3d ptNew = Media( ptStart, ptEnd) ; + pCompo1->ModifyStart( ptNew) ; + pCompo1->ModifyEnd( ptNew) ; + } + else { + double dAngEnd ; vtEnd.ToSpherical( nullptr, nullptr, &dAngEnd) ; + double dAngStart ; vtStart.ToSpherical( nullptr, nullptr, &dAngStart) ; + PtrOwner pClose( GetBiArc( ptEnd, dAngEnd, ptStart, dAngStart, 0.5)) ; + if ( ! IsNull( pClose)) + pCompo1->AddCurve( Release( pClose)) ; + else + pCompo1->Close() ; + } } // tipo di offset int nOffsType = ( bSquareMids ? ICurve::OFF_EXTEND : ICurve::OFF_FILLET) ;