- piccola modifica alla mappa dei polinomi di bernstein.

This commit is contained in:
Daniele Bariletti
2025-03-17 14:19:03 +01:00
parent 9d34df708d
commit cd56f80790
2 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -51,7 +51,7 @@ static bool ChangeStartForClosed( PolyLine& plU0, PolyLine& plU1, ICurveComposit
static bool ParametrizeByLen( const ICurveComposite* pCurve, DBLVECTOR& vParam) ;
static bool BuildCommonParam( const DBLMATRIX& mParam, DBLVECTOR& vCommonParam) ;
static unordered_map<pair<int,int>, DBLVECTOR, PairHash> m_mBernCache ; // mappa dei polinomi di bernstein
static unordered_map<INTINT, DBLVECTOR, PairHashIntInt> m_mBernCache ; // mappa dei polinomi di bernstein
//----------------------------------------------------------------------------
SurfBezier::SurfBezier( void)
@@ -319,7 +319,7 @@ SurfBezier::GetCentroid( Point3d& ptCen) const
bool
SurfBezier::GetBernstein( double dU, int nDegU, DBLVECTOR& vBernU) const
{
pair<int, int> key = std::make_pair( nDegU, int( dU * pow(2,24))) ;
INTINT key( nDegU, int( dU * pow(2,24))) ;
if ( m_mBernCache.find( key) == m_mBernCache.end()) {
DBLVECTOR vBern( nDegU + 1) ;
GetAllBernstein( dU, nDegU, vBern) ;
+3 -3
View File
@@ -25,10 +25,10 @@
using namespace std ;
class Tree ;
struct PairHash {
std::size_t operator()(const std::pair<int, double>& key) const {
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<double>{}(key.second);
std::size_t h2 = std::hash<int>{}(key.second);
return h1 ^ (h2 << 1); // Combine hashes
}
};