EgtGeomKernel :

- piccole migliorie a curve e superfici di Bezier.
This commit is contained in:
Dario Sassi
2025-08-30 10:51:48 +02:00
parent b2244b7f43
commit 2d6bf3d9dc
5 changed files with 18 additions and 18 deletions
+1
View File
@@ -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 ;
+14 -5
View File
@@ -48,7 +48,16 @@ using namespace std ;
GEOOBJ_REGISTER( SRF_BEZIER, NGE_S_BEZ, SurfBezier) ;
//----------------------------------------------------------------------------
struct PairHashIntInt {
size_t operator()(const pair<int, int>& key) const {
size_t h1 = hash<int>{}( key.first) ;
size_t h2 = hash<int>{}( key.second) ;
return h1 ^ ( h2 << 1) ; // Combine hashes
}
};
static unordered_map<INTINT, DBLVECTOR, PairHashIntInt> 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 ;
-10
View File
@@ -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<int, int>& key) const {
std::size_t h1 = std::hash<int>{}(key.first);
std::size_t h2 = std::hash<int>{}(key.second);
return h1 ^ (h2 << 1); // Combine hashes
}
};
//----------------------------------------------------------------------------
class SurfBezier : public ISurfBezier, public IGeoObjRW
{
+1 -1
View File
@@ -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<int64_t, int64_t> key( int64_t( GetHalfKey( dU)), int64_t( GetHalfKey( dV))) ;
if ( m_mPt3d.find( key) == m_mPt3d.end())
+2 -2
View File
@@ -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