mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-05-16 10:54:53 +03:00
0028240: Avoid redundant search for span index in evaluation of BSpline cache
This commit is contained in:
parent
1ef277c369
commit
a061150b0b
@ -1090,10 +1090,6 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const Standard_Real theDefl,
|
|||||||
Standard_Real tol = Max(0.01*aDefl2, 1.e-9);
|
Standard_Real tol = Max(0.01*aDefl2, 1.e-9);
|
||||||
Standard_Integer l;
|
Standard_Integer l;
|
||||||
|
|
||||||
// Calculations of B-spline values will be made using adaptor,
|
|
||||||
// because it caches the data for performance
|
|
||||||
GeomAdaptor_Surface aBSplAdaptor(aBS);
|
|
||||||
|
|
||||||
anUFlg(1) = Standard_True;
|
anUFlg(1) = Standard_True;
|
||||||
anUFlg(nbsu) = Standard_True;
|
anUFlg(nbsu) = Standard_True;
|
||||||
//myNbSamplesU = 2;
|
//myNbSamplesU = 2;
|
||||||
@ -1109,12 +1105,10 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const Standard_Real theDefl,
|
|||||||
}
|
}
|
||||||
|
|
||||||
t2 = anUPars(j);
|
t2 = anUPars(j);
|
||||||
// gp_Pnt p1 = aBS->Value(t2, t1);
|
gp_Pnt p1 = myS->Value(t2, t1);
|
||||||
gp_Pnt p1 = aBSplAdaptor.Value(t2, t1);
|
|
||||||
for(k = j+2; k <= nbsu; ++k) {
|
for(k = j+2; k <= nbsu; ++k) {
|
||||||
t2 = anUPars(k);
|
t2 = anUPars(k);
|
||||||
// gp_Pnt p2 = aBS->Value(t2, t1);
|
gp_Pnt p2 = myS->Value(t2, t1);
|
||||||
gp_Pnt p2 = aBSplAdaptor.Value(t2, t1);
|
|
||||||
//gce_MakeLin MkLin(p1, p2);
|
//gce_MakeLin MkLin(p1, p2);
|
||||||
//const gp_Lin& lin = MkLin.Value();
|
//const gp_Lin& lin = MkLin.Value();
|
||||||
|
|
||||||
@ -1129,8 +1123,7 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const Standard_Real theDefl,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// gp_Pnt pp = aBS->Value(anUPars(l), t1);
|
gp_Pnt pp = myS->Value(anUPars(l), t1);
|
||||||
gp_Pnt pp = aBSplAdaptor.Value(anUPars(l), t1);
|
|
||||||
Standard_Real d = lin.SquareDistance(pp);
|
Standard_Real d = lin.SquareDistance(pp);
|
||||||
|
|
||||||
if(d <= aDefl2) continue;
|
if(d <= aDefl2) continue;
|
||||||
@ -1197,12 +1190,10 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const Standard_Real theDefl,
|
|||||||
}
|
}
|
||||||
|
|
||||||
t2 = aVPars(j);
|
t2 = aVPars(j);
|
||||||
// gp_Pnt p1 = aBS->Value(t1, t2);
|
gp_Pnt p1 = myS->Value(t1, t2);
|
||||||
gp_Pnt p1 = aBSplAdaptor.Value(t1, t2);
|
|
||||||
for(k = j+2; k <= nbsv; ++k) {
|
for(k = j+2; k <= nbsv; ++k) {
|
||||||
t2 = aVPars(k);
|
t2 = aVPars(k);
|
||||||
// gp_Pnt p2 = aBS->Value(t1, t2);
|
gp_Pnt p2 = myS->Value(t1, t2);
|
||||||
gp_Pnt p2 = aBSplAdaptor.Value(t1, t2);
|
|
||||||
|
|
||||||
if(p1.SquareDistance(p2) <= tol) continue;
|
if(p1.SquareDistance(p2) <= tol) continue;
|
||||||
//gce_MakeLin MkLin(p1, p2);
|
//gce_MakeLin MkLin(p1, p2);
|
||||||
@ -1216,8 +1207,7 @@ void Adaptor3d_TopolTool::BSplSamplePnts(const Standard_Real theDefl,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// gp_Pnt pp = aBS->Value(t1, aVPars(l));
|
gp_Pnt pp = myS->Value(t1, aVPars(l));
|
||||||
gp_Pnt pp = aBSplAdaptor.Value(t1, aVPars(l));
|
|
||||||
Standard_Real d = lin.SquareDistance(pp);
|
Standard_Real d = lin.SquareDistance(pp);
|
||||||
|
|
||||||
if(d <= aDefl2) continue;
|
if(d <= aDefl2) continue;
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
// in TangExtendToConstraint; Continuity can be equal to 0
|
// in TangExtendToConstraint; Continuity can be equal to 0
|
||||||
|
|
||||||
#include <BSplCLib.hxx>
|
#include <BSplCLib.hxx>
|
||||||
|
#include <ElCLib.hxx>
|
||||||
#include <gp_Pnt.hxx>
|
#include <gp_Pnt.hxx>
|
||||||
#include <gp_Pnt2d.hxx>
|
#include <gp_Pnt2d.hxx>
|
||||||
#include <gp_Vec.hxx>
|
#include <gp_Vec.hxx>
|
||||||
@ -257,15 +258,8 @@ void BSplCLib::LocateParameter
|
|||||||
}
|
}
|
||||||
Standard_Integer Last1 = Last - 1;
|
Standard_Integer Last1 = Last - 1;
|
||||||
NewU = U;
|
NewU = U;
|
||||||
if (IsPeriodic) {
|
if (IsPeriodic && (NewU < UFirst || NewU > ULast))
|
||||||
Standard_Real Period = ULast - UFirst;
|
NewU = ElCLib::InPeriod(NewU, UFirst, ULast);
|
||||||
|
|
||||||
while (NewU > ULast )
|
|
||||||
NewU -= Period;
|
|
||||||
|
|
||||||
while (NewU < UFirst)
|
|
||||||
NewU += Period;
|
|
||||||
}
|
|
||||||
|
|
||||||
BSplCLib::Hunt (Knots, NewU, KnotIndex);
|
BSplCLib::Hunt (Knots, NewU, KnotIndex);
|
||||||
|
|
||||||
|
@ -1195,12 +1195,12 @@ public:
|
|||||||
//! Perform the evaluation of the Taylor expansion
|
//! Perform the evaluation of the Taylor expansion
|
||||||
//! of the Bspline normalized between 0 and 1.
|
//! of the Bspline normalized between 0 and 1.
|
||||||
//! Structure of result optimized for BSplCLib_Cache.
|
//! Structure of result optimized for BSplCLib_Cache.
|
||||||
Standard_EXPORT static void BuildCache (const Standard_Real theParameter, const Standard_Real theSpanDomain, const Standard_Boolean thePeriodicFlag, const Standard_Integer theDegree, const TColStd_Array1OfReal& theFlatKnots, const TColgp_Array1OfPnt& thePoles, const TColStd_Array1OfReal* theWeights, TColStd_Array2OfReal& theCacheArray);
|
Standard_EXPORT static void BuildCache (const Standard_Real theParameter, const Standard_Real theSpanDomain, const Standard_Boolean thePeriodicFlag, const Standard_Integer theDegree, const Standard_Integer theSpanIndex, const TColStd_Array1OfReal& theFlatKnots, const TColgp_Array1OfPnt& thePoles, const TColStd_Array1OfReal* theWeights, TColStd_Array2OfReal& theCacheArray);
|
||||||
|
|
||||||
//! Perform the evaluation of the Taylor expansion
|
//! Perform the evaluation of the Taylor expansion
|
||||||
//! of the Bspline normalized between 0 and 1.
|
//! of the Bspline normalized between 0 and 1.
|
||||||
//! Structure of result optimized for BSplCLib_Cache.
|
//! Structure of result optimized for BSplCLib_Cache.
|
||||||
Standard_EXPORT static void BuildCache (const Standard_Real theParameter, const Standard_Real theSpanDomain, const Standard_Boolean thePeriodicFlag, const Standard_Integer theDegree, const TColStd_Array1OfReal& theFlatKnots, const TColgp_Array1OfPnt2d& thePoles, const TColStd_Array1OfReal* theWeights, TColStd_Array2OfReal& theCacheArray);
|
Standard_EXPORT static void BuildCache (const Standard_Real theParameter, const Standard_Real theSpanDomain, const Standard_Boolean thePeriodicFlag, const Standard_Integer theDegree, const Standard_Integer theSpanIndex, const TColStd_Array1OfReal& theFlatKnots, const TColgp_Array1OfPnt2d& thePoles, const TColStd_Array1OfReal* theWeights, TColStd_Array2OfReal& theCacheArray);
|
||||||
|
|
||||||
static void PolesCoefficients (const TColgp_Array1OfPnt2d& Poles, TColgp_Array1OfPnt2d& CachePoles);
|
static void PolesCoefficients (const TColgp_Array1OfPnt2d& Poles, TColgp_Array1OfPnt2d& CachePoles);
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ void BSplCLib_Cache::BuildCache(const Standard_Real& theParameter,
|
|||||||
|
|
||||||
// Calculate new cache data
|
// Calculate new cache data
|
||||||
BSplCLib::BuildCache(mySpanStart, mySpanLength, thePeriodic, theDegree,
|
BSplCLib::BuildCache(mySpanStart, mySpanLength, thePeriodic, theDegree,
|
||||||
theFlatKnots, thePoles2d, theWeights,
|
mySpanIndex, theFlatKnots, thePoles2d, theWeights,
|
||||||
myPolesWeights->ChangeArray2());
|
myPolesWeights->ChangeArray2());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,7 +171,7 @@ void BSplCLib_Cache::BuildCache(const Standard_Real& theParameter,
|
|||||||
|
|
||||||
// Calculate new cache data
|
// Calculate new cache data
|
||||||
BSplCLib::BuildCache(mySpanStart, mySpanLength, thePeriodic, theDegree,
|
BSplCLib::BuildCache(mySpanStart, mySpanLength, thePeriodic, theDegree,
|
||||||
theFlatKnots, thePoles, theWeights,
|
mySpanIndex, theFlatKnots, thePoles, theWeights,
|
||||||
myPolesWeights->ChangeArray2());
|
myPolesWeights->ChangeArray2());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1098,13 +1098,14 @@ void BSplCLib::BuildCache(const Standard_Real theParameter,
|
|||||||
const Standard_Real theSpanDomain,
|
const Standard_Real theSpanDomain,
|
||||||
const Standard_Boolean thePeriodicFlag,
|
const Standard_Boolean thePeriodicFlag,
|
||||||
const Standard_Integer theDegree,
|
const Standard_Integer theDegree,
|
||||||
|
const Standard_Integer theSpanIndex,
|
||||||
const TColStd_Array1OfReal& theFlatKnots,
|
const TColStd_Array1OfReal& theFlatKnots,
|
||||||
const Array1OfPoints& thePoles,
|
const Array1OfPoints& thePoles,
|
||||||
const TColStd_Array1OfReal* theWeights,
|
const TColStd_Array1OfReal* theWeights,
|
||||||
TColStd_Array2OfReal& theCacheArray)
|
TColStd_Array2OfReal& theCacheArray)
|
||||||
{
|
{
|
||||||
Standard_Real aParam = theParameter;
|
Standard_Real aParam = theParameter;
|
||||||
Standard_Integer anIndex = 0;
|
Standard_Integer anIndex = theSpanIndex;
|
||||||
Standard_Integer aDimension;
|
Standard_Integer aDimension;
|
||||||
Standard_Boolean isRational;
|
Standard_Boolean isRational;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user