1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-18 14:27:39 +03:00

0028240: Avoid redundant search for span index in evaluation of BSpline cache

This commit is contained in:
abv
2016-12-18 09:21:54 +03:00
committed by apn
parent 1ef277c369
commit a061150b0b
5 changed files with 15 additions and 30 deletions

View File

@@ -28,6 +28,7 @@
// in TangExtendToConstraint; Continuity can be equal to 0
#include <BSplCLib.hxx>
#include <ElCLib.hxx>
#include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx>
#include <gp_Vec.hxx>
@@ -257,15 +258,8 @@ void BSplCLib::LocateParameter
}
Standard_Integer Last1 = Last - 1;
NewU = U;
if (IsPeriodic) {
Standard_Real Period = ULast - UFirst;
while (NewU > ULast )
NewU -= Period;
while (NewU < UFirst)
NewU += Period;
}
if (IsPeriodic && (NewU < UFirst || NewU > ULast))
NewU = ElCLib::InPeriod(NewU, UFirst, ULast);
BSplCLib::Hunt (Knots, NewU, KnotIndex);

View File

@@ -1195,12 +1195,12 @@ public:
//! Perform the evaluation of the Taylor expansion
//! of the Bspline normalized between 0 and 1.
//! 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
//! of the Bspline normalized between 0 and 1.
//! 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);

View File

@@ -132,7 +132,7 @@ void BSplCLib_Cache::BuildCache(const Standard_Real& theParameter,
// Calculate new cache data
BSplCLib::BuildCache(mySpanStart, mySpanLength, thePeriodic, theDegree,
theFlatKnots, thePoles2d, theWeights,
mySpanIndex, theFlatKnots, thePoles2d, theWeights,
myPolesWeights->ChangeArray2());
}
@@ -171,7 +171,7 @@ void BSplCLib_Cache::BuildCache(const Standard_Real& theParameter,
// Calculate new cache data
BSplCLib::BuildCache(mySpanStart, mySpanLength, thePeriodic, theDegree,
theFlatKnots, thePoles, theWeights,
mySpanIndex, theFlatKnots, thePoles, theWeights,
myPolesWeights->ChangeArray2());
}

View File

@@ -1098,13 +1098,14 @@ void BSplCLib::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 Array1OfPoints& thePoles,
const TColStd_Array1OfReal* theWeights,
TColStd_Array2OfReal& theCacheArray)
{
Standard_Real aParam = theParameter;
Standard_Integer anIndex = 0;
Standard_Integer anIndex = theSpanIndex;
Standard_Integer aDimension;
Standard_Boolean isRational;