From 2d6bf3d9dc3b9a4cfb680014c612cdb6d07554fc Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Sat, 30 Aug 2025 10:51:48 +0200 Subject: [PATCH] EgtGeomKernel : - piccole migliorie a curve e superfici di Bezier. --- CurveBezier.cpp | 1 + SurfBezier.cpp | 19 ++++++++++++++----- SurfBezier.h | 10 ---------- Tree.cpp | 2 +- Tree.h | 4 ++-- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/CurveBezier.cpp b/CurveBezier.cpp index 4a5aa42..558340e 100644 --- a/CurveBezier.cpp +++ b/CurveBezier.cpp @@ -369,6 +369,7 @@ CurveBezier::CopyFrom( const CurveBezier& cbSrc) return true ; if ( ! Init( cbSrc.m_nDeg, cbSrc.m_bRat)) return false ; + m_dParSing = cbSrc.m_dParSing ; m_vPtCtrl = cbSrc.m_vPtCtrl ; if ( cbSrc.m_bRat) m_vWeCtrl = cbSrc.m_vWeCtrl ; diff --git a/SurfBezier.cpp b/SurfBezier.cpp index f0fbd1b..4e900c9 100644 --- a/SurfBezier.cpp +++ b/SurfBezier.cpp @@ -48,7 +48,16 @@ using namespace std ; GEOOBJ_REGISTER( SRF_BEZIER, NGE_S_BEZ, SurfBezier) ; //---------------------------------------------------------------------------- +struct PairHashIntInt { + size_t operator()(const pair& key) const { + size_t h1 = hash{}( key.first) ; + size_t h2 = hash{}( key.second) ; + return h1 ^ ( h2 << 1) ; // Combine hashes + } +}; static unordered_map s_mBernCache ; // mappa dei polinomi di bernstein + +//---------------------------------------------------------------------------- static double s_dAuxSurfTol = 200 * EPS_SMALL ; static double s_dAuxSurfRefinedTol = 50 * EPS_SMALL ; @@ -2162,7 +2171,7 @@ bool SurfBezier::IncreaseUV( double& dUV, double dxy, bool bUOrV, double* dUVCopy, bool bModifyOrig) const { double dUVTest ; - if (dUVCopy == nullptr && !bModifyOrig) + if ( dUVCopy == nullptr && ! bModifyOrig) return false ; if ( dUVCopy != nullptr) { *dUVCopy = dUV + dxy ; @@ -2175,15 +2184,15 @@ SurfBezier::IncreaseUV( double& dUV, double dxy, bool bUOrV, double* dUVCopy, bo if ( bUOrV) { if ( dUVTest < 0) - dUVTest = 0 ; + dUVTest = 0 ; else if ( dUVTest > m_nSpanU * SBZ_TREG_COEFF ) - dUVTest = m_nSpanU * SBZ_TREG_COEFF ; + dUVTest = m_nSpanU * SBZ_TREG_COEFF ; } else { if ( dUVTest < 0) - dUVTest = 0 ; + dUVTest = 0 ; else if ( dUVTest > m_nSpanV * SBZ_TREG_COEFF ) - dUVTest = m_nSpanV * SBZ_TREG_COEFF ; + dUVTest = m_nSpanV * SBZ_TREG_COEFF ; } if ( bModifyOrig) dUV = dUVTest ; diff --git a/SurfBezier.h b/SurfBezier.h index 9c1acf1..4892255 100644 --- a/SurfBezier.h +++ b/SurfBezier.h @@ -22,16 +22,6 @@ #include "/EgtDev/Include/EGkSurfBezier.h" #include "/EgtDev/Include/EGkGeoCollection.h" -class Tree ; - -struct PairHashIntInt { - std::size_t operator()(const std::pair& key) const { - std::size_t h1 = std::hash{}(key.first); - std::size_t h2 = std::hash{}(key.second); - return h1 ^ (h2 << 1); // Combine hashes - } -}; - //---------------------------------------------------------------------------- class SurfBezier : public ISurfBezier, public IGeoObjRW { diff --git a/Tree.cpp b/Tree.cpp index 0b7c94c..cc23a44 100644 --- a/Tree.cpp +++ b/Tree.cpp @@ -125,7 +125,7 @@ Tree::GetPoint( double dU, double dV, Point3d& ptP) const //---------------------------------------------------------------------------- bool -Tree::SavePoint( double dU, double dV, Point3d& ptP) +Tree::SavePoint( double dU, double dV, const Point3d& ptP) { pair key( int64_t( GetHalfKey( dU)), int64_t( GetHalfKey( dV))) ; if ( m_mPt3d.find( key) == m_mPt3d.end()) diff --git a/Tree.h b/Tree.h index 72fb56f..460189f 100644 --- a/Tree.h +++ b/Tree.h @@ -306,8 +306,8 @@ class Tree bool UpdateSplitLoop( ICurveComposite* pCC, Point3d& pt) ; bool VerifyLoopOrientation( ICURVEPLIST& vpCrv, BOOLVECTOR& vbOrientation) const ; // verifico l'orientazione ( CCW o CW) delle polyline in base a come sono contenute le une nelle altre bool AdjustLoop( PolyLine& pl, POLYLINEVECTOR& vPl, BOOLVECTOR& vbOrientation) const ; - bool GetPoint(double dU, double dV, Point3d& pt) const ; - bool SavePoint( double dU, double dV, Point3d& pt) ; + bool GetPoint(double dU, double dV, Point3d& ptP) const ; + bool SavePoint( double dU, double dV, const Point3d& ptP) ; private : const SurfBezier* m_pSrfBz ; // superficie di bezier