mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
Coding - Apply .clang-format formatting #286
Update empty method guards to new style with regex (see PR). Used clang-format 18.1.8. New actions to validate code formatting is added. Update .clang-format with disabling of include sorting. It is temporary changes, then include will be sorted. Apply formatting for /src and /tools folder. The files with .hxx,.cxx,.lxx,.h,.pxx,.hpp,*.cpp extensions.
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -19,178 +19,169 @@
|
||||
#include <TColgp_Array1OfPnt2d.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : MaxDegree
|
||||
//purpose :
|
||||
// function : MaxDegree
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline Standard_Integer BSplCLib::MaxDegree ()
|
||||
inline Standard_Integer BSplCLib::MaxDegree()
|
||||
{
|
||||
return 25;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NoWeights
|
||||
//purpose :
|
||||
// function : NoWeights
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline TColStd_Array1OfReal* BSplCLib::NoWeights()
|
||||
inline TColStd_Array1OfReal* BSplCLib::NoWeights()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NoMults
|
||||
//purpose :
|
||||
// function : NoMults
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline TColStd_Array1OfInteger* BSplCLib::NoMults()
|
||||
inline TColStd_Array1OfInteger* BSplCLib::NoMults()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CoefsD0
|
||||
//purpose :
|
||||
// function : CoefsD0
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline void BSplCLib::CoefsD0(const Standard_Real U,
|
||||
const TColgp_Array1OfPnt& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
gp_Pnt& P)
|
||||
const TColgp_Array1OfPnt& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
gp_Pnt& P)
|
||||
{
|
||||
BSplCLib::CacheD0(U, Poles.Length() -1, 0., 1., Poles, Weights, P);
|
||||
BSplCLib::CacheD0(U, Poles.Length() - 1, 0., 1., Poles, Weights, P);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CoefsD0
|
||||
//purpose :
|
||||
// function : CoefsD0
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline void BSplCLib::CoefsD0(const Standard_Real U,
|
||||
const TColgp_Array1OfPnt2d& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
gp_Pnt2d& P)
|
||||
const TColgp_Array1OfPnt2d& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
gp_Pnt2d& P)
|
||||
{
|
||||
BSplCLib::CacheD0(U, Poles.Length() -1, 0., 1., Poles, Weights, P);
|
||||
BSplCLib::CacheD0(U, Poles.Length() - 1, 0., 1., Poles, Weights, P);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CoefsD1
|
||||
//purpose :
|
||||
// function : CoefsD1
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline void BSplCLib::CoefsD1(const Standard_Real U,
|
||||
const TColgp_Array1OfPnt& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& Vec)
|
||||
const TColgp_Array1OfPnt& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& Vec)
|
||||
{
|
||||
BSplCLib::CacheD1(U, Poles.Length() -1, 0., 1., Poles, Weights, P, Vec);
|
||||
BSplCLib::CacheD1(U, Poles.Length() - 1, 0., 1., Poles, Weights, P, Vec);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CoefsD1
|
||||
//purpose :
|
||||
// function : CoefsD1
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline void BSplCLib::CoefsD1(const Standard_Real U,
|
||||
const TColgp_Array1OfPnt2d& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
gp_Pnt2d& P,
|
||||
gp_Vec2d& Vec)
|
||||
const TColgp_Array1OfPnt2d& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
gp_Pnt2d& P,
|
||||
gp_Vec2d& Vec)
|
||||
{
|
||||
BSplCLib::CacheD1(U, Poles.Length() -1, 0., 1., Poles, Weights, P, Vec);
|
||||
BSplCLib::CacheD1(U, Poles.Length() - 1, 0., 1., Poles, Weights, P, Vec);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CoefsD2
|
||||
//purpose :
|
||||
// function : CoefsD2
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline void BSplCLib::CoefsD2(const Standard_Real U,
|
||||
const TColgp_Array1OfPnt& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& Vec1,
|
||||
gp_Vec& Vec2)
|
||||
const TColgp_Array1OfPnt& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& Vec1,
|
||||
gp_Vec& Vec2)
|
||||
{
|
||||
BSplCLib::CacheD2(U, Poles.Length() -1, 0., 1., Poles, Weights,
|
||||
P, Vec1, Vec2);
|
||||
BSplCLib::CacheD2(U, Poles.Length() - 1, 0., 1., Poles, Weights, P, Vec1, Vec2);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CoefsD2
|
||||
//purpose :
|
||||
// function : CoefsD2
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline void BSplCLib::CoefsD2(const Standard_Real U,
|
||||
const TColgp_Array1OfPnt2d& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
gp_Pnt2d& P,
|
||||
gp_Vec2d& Vec1,
|
||||
gp_Vec2d& Vec2)
|
||||
const TColgp_Array1OfPnt2d& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
gp_Pnt2d& P,
|
||||
gp_Vec2d& Vec1,
|
||||
gp_Vec2d& Vec2)
|
||||
{
|
||||
BSplCLib::CacheD2(U, Poles.Length() -1, 0., 1., Poles, Weights,
|
||||
P, Vec1, Vec2);
|
||||
BSplCLib::CacheD2(U, Poles.Length() - 1, 0., 1., Poles, Weights, P, Vec1, Vec2);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CoefsD3
|
||||
//purpose :
|
||||
// function : CoefsD3
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline void BSplCLib::CoefsD3(const Standard_Real U,
|
||||
const TColgp_Array1OfPnt& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& Vec1,
|
||||
gp_Vec& Vec2,
|
||||
gp_Vec& Vec3)
|
||||
const TColgp_Array1OfPnt& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& Vec1,
|
||||
gp_Vec& Vec2,
|
||||
gp_Vec& Vec3)
|
||||
{
|
||||
BSplCLib::CacheD3(U, Poles.Length() -1, 0., 1., Poles, Weights,
|
||||
P, Vec1, Vec2, Vec3);
|
||||
BSplCLib::CacheD3(U, Poles.Length() - 1, 0., 1., Poles, Weights, P, Vec1, Vec2, Vec3);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CoefsD3
|
||||
//purpose :
|
||||
// function : CoefsD3
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline void BSplCLib::CoefsD3(const Standard_Real U,
|
||||
const TColgp_Array1OfPnt2d& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
gp_Pnt2d& P,
|
||||
gp_Vec2d& Vec1,
|
||||
gp_Vec2d& Vec2,
|
||||
gp_Vec2d& Vec3)
|
||||
const TColgp_Array1OfPnt2d& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
gp_Pnt2d& P,
|
||||
gp_Vec2d& Vec1,
|
||||
gp_Vec2d& Vec2,
|
||||
gp_Vec2d& Vec3)
|
||||
{
|
||||
BSplCLib::CacheD3(U, Poles.Length() -1, 0., 1., Poles, Weights,
|
||||
P, Vec1, Vec2, Vec3);
|
||||
BSplCLib::CacheD3(U, Poles.Length() - 1, 0., 1., Poles, Weights, P, Vec1, Vec2, Vec3);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PolesCoefficients
|
||||
//purpose :
|
||||
// function : PolesCoefficients
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline void BSplCLib::PolesCoefficients
|
||||
(const TColgp_Array1OfPnt& Poles,
|
||||
TColgp_Array1OfPnt& CachePoles)
|
||||
inline void BSplCLib::PolesCoefficients(const TColgp_Array1OfPnt& Poles,
|
||||
TColgp_Array1OfPnt& CachePoles)
|
||||
{
|
||||
BSplCLib::PolesCoefficients(Poles, PLib::NoWeights(),
|
||||
CachePoles, PLib::NoWeights());
|
||||
BSplCLib::PolesCoefficients(Poles, PLib::NoWeights(), CachePoles, PLib::NoWeights());
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PolesCoefficients
|
||||
//purpose :
|
||||
// function : PolesCoefficients
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
|
||||
inline void BSplCLib::PolesCoefficients
|
||||
(const TColgp_Array1OfPnt2d& Poles,
|
||||
TColgp_Array1OfPnt2d& CachePoles)
|
||||
inline void BSplCLib::PolesCoefficients(const TColgp_Array1OfPnt2d& Poles,
|
||||
TColgp_Array1OfPnt2d& CachePoles)
|
||||
{
|
||||
BSplCLib::PolesCoefficients(Poles, PLib::NoWeights(),
|
||||
CachePoles, PLib::NoWeights());
|
||||
BSplCLib::PolesCoefficients(Poles, PLib::NoWeights(), CachePoles, PLib::NoWeights());
|
||||
}
|
||||
|
||||
|
@@ -20,32 +20,22 @@
|
||||
|
||||
#define Dimension_gen 2
|
||||
|
||||
#define Array1OfPoints TColgp_Array1OfPnt2d
|
||||
#define Point gp_Pnt2d
|
||||
#define Vector gp_Vec2d
|
||||
#define Array1OfPoints TColgp_Array1OfPnt2d
|
||||
#define Point gp_Pnt2d
|
||||
#define Vector gp_Vec2d
|
||||
|
||||
#define PointToCoords(carr,pnt,op) \
|
||||
(carr)[0] = (pnt).X() op, \
|
||||
(carr)[1] = (pnt).Y() op
|
||||
#define PointToCoords(carr, pnt, op) (carr)[0] = (pnt).X() op, (carr)[1] = (pnt).Y() op
|
||||
|
||||
#define CoordsToPoint(pnt,carr,op) \
|
||||
(pnt).SetX ((carr)[0] op), \
|
||||
(pnt).SetY ((carr)[1] op)
|
||||
#define CoordsToPoint(pnt, carr, op) (pnt).SetX((carr)[0] op), (pnt).SetY((carr)[1] op)
|
||||
|
||||
#define NullifyPoint(pnt) \
|
||||
(pnt).SetCoord (0.,0.)
|
||||
#define NullifyPoint(pnt) (pnt).SetCoord(0., 0.)
|
||||
|
||||
#define NullifyCoords(carr) \
|
||||
(carr)[0] = (carr)[1] = 0.
|
||||
#define NullifyCoords(carr) (carr)[0] = (carr)[1] = 0.
|
||||
|
||||
#define ModifyCoords(carr,op) \
|
||||
(carr)[0] op, \
|
||||
(carr)[1] op
|
||||
#define ModifyCoords(carr, op) (carr)[0] op, (carr)[1] op
|
||||
|
||||
#define CopyCoords(carr,carr2) \
|
||||
(carr)[0] = (carr2)[0], \
|
||||
(carr)[1] = (carr2)[1]
|
||||
#define CopyCoords(carr, carr2) (carr)[0] = (carr2)[0], (carr)[1] = (carr2)[1]
|
||||
|
||||
#define BSplCLib_DataContainer BSplCLib_DataContainer_2d
|
||||
|
||||
#define BSplCLib_DataContainer BSplCLib_DataContainer_2d
|
||||
|
||||
#include "../BSplCLib/BSplCLib_CurveComputation.gxx"
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,6 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <BSplCLib.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <gp_Pnt2d.hxx>
|
||||
@@ -27,36 +26,25 @@
|
||||
// ***************************
|
||||
#define Dimension_gen 3
|
||||
|
||||
#define Array1OfPoints TColgp_Array1OfPnt
|
||||
#define Point gp_Pnt
|
||||
#define Vector gp_Vec
|
||||
#define Array1OfPoints TColgp_Array1OfPnt
|
||||
#define Point gp_Pnt
|
||||
#define Vector gp_Vec
|
||||
|
||||
#define PointToCoords(carr,pnt,op) \
|
||||
(carr)[0] = (pnt).X() op, \
|
||||
(carr)[1] = (pnt).Y() op, \
|
||||
(carr)[2] = (pnt).Z() op
|
||||
#define PointToCoords(carr, pnt, op) \
|
||||
(carr)[0] = (pnt).X() op, (carr)[1] = (pnt).Y() op, (carr)[2] = (pnt).Z() op
|
||||
|
||||
#define CoordsToPoint(pnt,carr,op) \
|
||||
(pnt).SetX ((carr)[0] op), \
|
||||
(pnt).SetY ((carr)[1] op), \
|
||||
(pnt).SetZ ((carr)[2] op)
|
||||
#define CoordsToPoint(pnt, carr, op) \
|
||||
(pnt).SetX((carr)[0] op), (pnt).SetY((carr)[1] op), (pnt).SetZ((carr)[2] op)
|
||||
|
||||
#define NullifyPoint(pnt) \
|
||||
(pnt).SetCoord (0.,0.,0.)
|
||||
#define NullifyPoint(pnt) (pnt).SetCoord(0., 0., 0.)
|
||||
|
||||
#define NullifyCoords(carr) \
|
||||
(carr)[0] = (carr)[1] = (carr)[2] = 0.
|
||||
#define NullifyCoords(carr) (carr)[0] = (carr)[1] = (carr)[2] = 0.
|
||||
|
||||
#define ModifyCoords(carr,op) \
|
||||
(carr)[0] op, \
|
||||
(carr)[1] op, \
|
||||
(carr)[2] op
|
||||
#define ModifyCoords(carr, op) (carr)[0] op, (carr)[1] op, (carr)[2] op
|
||||
|
||||
#define CopyCoords(carr,carr2) \
|
||||
(carr)[0] = (carr2)[0], \
|
||||
(carr)[1] = (carr2)[1], \
|
||||
(carr)[2] = (carr2)[2]
|
||||
#define CopyCoords(carr, carr2) \
|
||||
(carr)[0] = (carr2)[0], (carr)[1] = (carr2)[1], (carr)[2] = (carr2)[2]
|
||||
|
||||
#define BSplCLib_DataContainer BSplCLib_DataContainer_3d
|
||||
|
||||
|
||||
#include "../BSplCLib/BSplCLib_CurveComputation.gxx"
|
||||
|
@@ -22,8 +22,8 @@
|
||||
#define No_Standard_OutOfRange
|
||||
|
||||
//=======================================================================
|
||||
//struct : BSplCLib_BezierArrays
|
||||
//purpose: Auxiliary structure providing standard definitions of bspline
|
||||
// struct : BSplCLib_BezierArrays
|
||||
// purpose: Auxiliary structure providing standard definitions of bspline
|
||||
// knots for bezier (using stack allocation)
|
||||
//=======================================================================
|
||||
|
||||
@@ -31,11 +31,12 @@ class BSplCLib_BezierArrays
|
||||
{
|
||||
public:
|
||||
BSplCLib_BezierArrays(Standard_Integer Degree)
|
||||
: aKnots{0., 1.},
|
||||
aMults{Degree + 1, Degree + 1},
|
||||
knots(aKnots[0], 1, 2),
|
||||
mults(aMults[0], 1, 2)
|
||||
{}
|
||||
: aKnots{0., 1.},
|
||||
aMults{Degree + 1, Degree + 1},
|
||||
knots(aKnots[0], 1, 2),
|
||||
mults(aMults[0], 1, 2)
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
Standard_Real aKnots[2];
|
||||
@@ -46,207 +47,180 @@ public:
|
||||
TColStd_Array1OfInteger mults;
|
||||
};
|
||||
|
||||
//=======================================================================
|
||||
//function : IncreaseDegree
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void BSplCLib::IncreaseDegree(const Standard_Integer NewDegree,
|
||||
const TColgp_Array1OfPnt& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
TColgp_Array1OfPnt& NewPoles,
|
||||
TColStd_Array1OfReal* NewWeights)
|
||||
void BSplCLib::IncreaseDegree(const Standard_Integer NewDegree,
|
||||
const TColgp_Array1OfPnt& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
TColgp_Array1OfPnt& NewPoles,
|
||||
TColStd_Array1OfReal* NewWeights)
|
||||
{
|
||||
Standard_Integer deg = Poles.Length() - 1;
|
||||
Standard_Integer deg = Poles.Length() - 1;
|
||||
BSplCLib_BezierArrays bzarr(deg);
|
||||
BSplCLib::IncreaseDegree(deg, NewDegree, 0,
|
||||
Poles, Weights, bzarr.knots, bzarr.mults,
|
||||
NewPoles, NewWeights, bzarr.knots, bzarr.mults);
|
||||
BSplCLib::IncreaseDegree(deg,
|
||||
NewDegree,
|
||||
0,
|
||||
Poles,
|
||||
Weights,
|
||||
bzarr.knots,
|
||||
bzarr.mults,
|
||||
NewPoles,
|
||||
NewWeights,
|
||||
bzarr.knots,
|
||||
bzarr.mults);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : IncreaseDegree
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void BSplCLib::IncreaseDegree(const Standard_Integer NewDegree,
|
||||
const TColgp_Array1OfPnt2d& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
TColgp_Array1OfPnt2d& NewPoles,
|
||||
TColStd_Array1OfReal* NewWeights)
|
||||
void BSplCLib::IncreaseDegree(const Standard_Integer NewDegree,
|
||||
const TColgp_Array1OfPnt2d& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
TColgp_Array1OfPnt2d& NewPoles,
|
||||
TColStd_Array1OfReal* NewWeights)
|
||||
{
|
||||
Standard_Integer deg = Poles.Length() - 1;
|
||||
Standard_Integer deg = Poles.Length() - 1;
|
||||
BSplCLib_BezierArrays bzarr(deg);
|
||||
BSplCLib::IncreaseDegree(deg, NewDegree, 0,
|
||||
Poles, Weights, bzarr.knots, bzarr.mults,
|
||||
NewPoles, NewWeights, bzarr.knots, bzarr.mults);
|
||||
BSplCLib::IncreaseDegree(deg,
|
||||
NewDegree,
|
||||
0,
|
||||
Poles,
|
||||
Weights,
|
||||
bzarr.knots,
|
||||
bzarr.mults,
|
||||
NewPoles,
|
||||
NewWeights,
|
||||
bzarr.knots,
|
||||
bzarr.mults);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PolesCoefficients
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void BSplCLib::PolesCoefficients(const TColgp_Array1OfPnt& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
TColgp_Array1OfPnt& CachePoles,
|
||||
TColStd_Array1OfReal* CacheWeights)
|
||||
void BSplCLib::PolesCoefficients(const TColgp_Array1OfPnt& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
TColgp_Array1OfPnt& CachePoles,
|
||||
TColStd_Array1OfReal* CacheWeights)
|
||||
{
|
||||
Standard_Integer deg = Poles.Length() - 1;
|
||||
TColStd_Array1OfReal bidflatknots (FlatBezierKnots(deg), 1, 2*(deg+1));
|
||||
BSplCLib::BuildCache(0.,1.,0,deg,bidflatknots,
|
||||
Poles, Weights, CachePoles,CacheWeights);
|
||||
Standard_Integer deg = Poles.Length() - 1;
|
||||
TColStd_Array1OfReal bidflatknots(FlatBezierKnots(deg), 1, 2 * (deg + 1));
|
||||
BSplCLib::BuildCache(0., 1., 0, deg, bidflatknots, Poles, Weights, CachePoles, CacheWeights);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : PolesCoefficients
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void BSplCLib::PolesCoefficients(const TColgp_Array1OfPnt2d& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
TColgp_Array1OfPnt2d& CachePoles,
|
||||
TColStd_Array1OfReal* CacheWeights)
|
||||
void BSplCLib::PolesCoefficients(const TColgp_Array1OfPnt2d& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
TColgp_Array1OfPnt2d& CachePoles,
|
||||
TColStd_Array1OfReal* CacheWeights)
|
||||
{
|
||||
Standard_Integer deg = Poles.Length() - 1;
|
||||
TColStd_Array1OfReal bidflatknots (FlatBezierKnots(deg), 1, 2*(deg+1));
|
||||
BSplCLib::BuildCache(0.,1.,0,deg,bidflatknots,
|
||||
Poles, Weights, CachePoles,CacheWeights);
|
||||
Standard_Integer deg = Poles.Length() - 1;
|
||||
TColStd_Array1OfReal bidflatknots(FlatBezierKnots(deg), 1, 2 * (deg + 1));
|
||||
BSplCLib::BuildCache(0., 1., 0, deg, bidflatknots, Poles, Weights, CachePoles, CacheWeights);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : D0
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void BSplCLib::D0(const Standard_Real U,
|
||||
const TColgp_Array1OfPnt& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
gp_Pnt& P)
|
||||
const TColgp_Array1OfPnt& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
gp_Pnt& P)
|
||||
{
|
||||
Standard_Integer deg = Poles.Length() - 1;
|
||||
Standard_Integer deg = Poles.Length() - 1;
|
||||
BSplCLib_BezierArrays bzarr(deg);
|
||||
BSplCLib::D0(U, 1, deg, 0, Poles, Weights, bzarr.knots, &bzarr.mults, P);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : D0
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void BSplCLib::D0(const Standard_Real U,
|
||||
const TColgp_Array1OfPnt2d& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
gp_Pnt2d& P)
|
||||
const TColgp_Array1OfPnt2d& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
gp_Pnt2d& P)
|
||||
{
|
||||
Standard_Integer deg = Poles.Length() - 1;
|
||||
Standard_Integer deg = Poles.Length() - 1;
|
||||
BSplCLib_BezierArrays bzarr(deg);
|
||||
BSplCLib::D0(U, 1, deg, 0, Poles, Weights, bzarr.knots, &bzarr.mults, P);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : D1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void BSplCLib::D1(const Standard_Real U,
|
||||
const TColgp_Array1OfPnt& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& V)
|
||||
const TColgp_Array1OfPnt& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& V)
|
||||
{
|
||||
Standard_Integer deg = Poles.Length() - 1;
|
||||
Standard_Integer deg = Poles.Length() - 1;
|
||||
BSplCLib_BezierArrays bzarr(deg);
|
||||
BSplCLib::D1(U, 1, deg, 0, Poles, Weights, bzarr.knots, &bzarr.mults, P, V);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : D1
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void BSplCLib::D1(const Standard_Real U,
|
||||
const TColgp_Array1OfPnt2d& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
gp_Pnt2d& P,
|
||||
gp_Vec2d& V)
|
||||
const TColgp_Array1OfPnt2d& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
gp_Pnt2d& P,
|
||||
gp_Vec2d& V)
|
||||
{
|
||||
Standard_Integer deg = Poles.Length() - 1;
|
||||
Standard_Integer deg = Poles.Length() - 1;
|
||||
BSplCLib_BezierArrays bzarr(deg);
|
||||
BSplCLib::D1(U, 1, deg, 0, Poles, Weights, bzarr.knots, &bzarr.mults, P, V);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : D2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void BSplCLib::D2(const Standard_Real U,
|
||||
const TColgp_Array1OfPnt& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& V1,
|
||||
gp_Vec& V2)
|
||||
const TColgp_Array1OfPnt& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& V1,
|
||||
gp_Vec& V2)
|
||||
{
|
||||
Standard_Integer deg = Poles.Length() - 1;
|
||||
Standard_Integer deg = Poles.Length() - 1;
|
||||
BSplCLib_BezierArrays bzarr(deg);
|
||||
BSplCLib::D2(U, 1, deg, 0, Poles, Weights, bzarr.knots, &bzarr.mults, P, V1, V2);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : D2
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void BSplCLib::D2(const Standard_Real U,
|
||||
const TColgp_Array1OfPnt2d& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
gp_Pnt2d& P,
|
||||
gp_Vec2d& V1,
|
||||
gp_Vec2d& V2)
|
||||
const TColgp_Array1OfPnt2d& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
gp_Pnt2d& P,
|
||||
gp_Vec2d& V1,
|
||||
gp_Vec2d& V2)
|
||||
{
|
||||
Standard_Integer deg = Poles.Length() - 1;
|
||||
Standard_Integer deg = Poles.Length() - 1;
|
||||
BSplCLib_BezierArrays bzarr(deg);
|
||||
BSplCLib::D2(U, 1, deg, 0, Poles, Weights, bzarr.knots, &bzarr.mults, P, V1, V2);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : D3
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void BSplCLib::D3(const Standard_Real U,
|
||||
const TColgp_Array1OfPnt& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& V1,
|
||||
gp_Vec& V2,
|
||||
gp_Vec& V3)
|
||||
const TColgp_Array1OfPnt& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
gp_Pnt& P,
|
||||
gp_Vec& V1,
|
||||
gp_Vec& V2,
|
||||
gp_Vec& V3)
|
||||
{
|
||||
Standard_Integer deg = Poles.Length() - 1;
|
||||
Standard_Integer deg = Poles.Length() - 1;
|
||||
BSplCLib_BezierArrays bzarr(deg);
|
||||
BSplCLib::D3(U, 1, deg, 0, Poles, Weights, bzarr.knots, &bzarr.mults,
|
||||
P, V1, V2, V3);
|
||||
BSplCLib::D3(U, 1, deg, 0, Poles, Weights, bzarr.knots, &bzarr.mults, P, V1, V2, V3);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : D3
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void BSplCLib::D3(const Standard_Real U,
|
||||
const TColgp_Array1OfPnt2d& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
gp_Pnt2d& P,
|
||||
gp_Vec2d& V1,
|
||||
gp_Vec2d& V2,
|
||||
gp_Vec2d& V3)
|
||||
const TColgp_Array1OfPnt2d& Poles,
|
||||
const TColStd_Array1OfReal* Weights,
|
||||
gp_Pnt2d& P,
|
||||
gp_Vec2d& V1,
|
||||
gp_Vec2d& V2,
|
||||
gp_Vec2d& V3)
|
||||
{
|
||||
Standard_Integer deg = Poles.Length() - 1;
|
||||
Standard_Integer deg = Poles.Length() - 1;
|
||||
BSplCLib_BezierArrays bzarr(deg);
|
||||
BSplCLib::D3(U, 1, deg, 0, Poles, Weights, bzarr.knots, &bzarr.mults,
|
||||
P, V1, V2, V3);
|
||||
BSplCLib::D3(U, 1, deg, 0, Poles, Weights, bzarr.knots, &bzarr.mults, P, V1, V2, V3);
|
||||
}
|
||||
|
||||
|
@@ -20,87 +20,100 @@
|
||||
#include <TColgp_HArray1OfPnt2d.hxx>
|
||||
#include <TColStd_HArray2OfReal.hxx>
|
||||
|
||||
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BSplCLib_Cache,Standard_Transient)
|
||||
IMPLEMENT_STANDARD_RTTIEXT(BSplCLib_Cache, Standard_Transient)
|
||||
|
||||
//! Converts handle of array of Standard_Real into the pointer to Standard_Real
|
||||
static Standard_Real* ConvertArray(const Handle(TColStd_HArray2OfReal)& theHArray)
|
||||
{
|
||||
const TColStd_Array2OfReal& anArray = theHArray->Array2();
|
||||
return (Standard_Real*) &(anArray(anArray.LowerRow(), anArray.LowerCol()));
|
||||
return (Standard_Real*)&(anArray(anArray.LowerRow(), anArray.LowerCol()));
|
||||
}
|
||||
|
||||
BSplCLib_Cache::BSplCLib_Cache(const Standard_Integer& theDegree,
|
||||
const Standard_Boolean& thePeriodic,
|
||||
const TColStd_Array1OfReal& theFlatKnots,
|
||||
const TColgp_Array1OfPnt2d& /* only used to distinguish from 3d variant */,
|
||||
const TColStd_Array1OfReal* theWeights)
|
||||
: myIsRational(theWeights != NULL),
|
||||
myParams (theDegree, thePeriodic, theFlatKnots)
|
||||
BSplCLib_Cache::BSplCLib_Cache(
|
||||
const Standard_Integer& theDegree,
|
||||
const Standard_Boolean& thePeriodic,
|
||||
const TColStd_Array1OfReal& theFlatKnots,
|
||||
const TColgp_Array1OfPnt2d& /* only used to distinguish from 3d variant */,
|
||||
const TColStd_Array1OfReal* theWeights)
|
||||
: myIsRational(theWeights != NULL),
|
||||
myParams(theDegree, thePeriodic, theFlatKnots)
|
||||
{
|
||||
Standard_Integer aPWColNumber = (myIsRational ? 3 : 2);
|
||||
myPolesWeights = new TColStd_HArray2OfReal (1, theDegree + 1, 1, aPWColNumber);
|
||||
myPolesWeights = new TColStd_HArray2OfReal(1, theDegree + 1, 1, aPWColNumber);
|
||||
}
|
||||
|
||||
BSplCLib_Cache::BSplCLib_Cache(const Standard_Integer& theDegree,
|
||||
const Standard_Boolean& thePeriodic,
|
||||
const TColStd_Array1OfReal& theFlatKnots,
|
||||
const TColgp_Array1OfPnt& /* only used to distinguish from 2d variant */,
|
||||
const TColStd_Array1OfReal* theWeights)
|
||||
: myIsRational(theWeights != NULL),
|
||||
myParams (theDegree, thePeriodic, theFlatKnots)
|
||||
BSplCLib_Cache::BSplCLib_Cache(
|
||||
const Standard_Integer& theDegree,
|
||||
const Standard_Boolean& thePeriodic,
|
||||
const TColStd_Array1OfReal& theFlatKnots,
|
||||
const TColgp_Array1OfPnt& /* only used to distinguish from 2d variant */,
|
||||
const TColStd_Array1OfReal* theWeights)
|
||||
: myIsRational(theWeights != NULL),
|
||||
myParams(theDegree, thePeriodic, theFlatKnots)
|
||||
{
|
||||
Standard_Integer aPWColNumber = (myIsRational ? 4 : 3);
|
||||
myPolesWeights = new TColStd_HArray2OfReal (1, theDegree + 1, 1, aPWColNumber);
|
||||
myPolesWeights = new TColStd_HArray2OfReal(1, theDegree + 1, 1, aPWColNumber);
|
||||
}
|
||||
|
||||
Standard_Boolean BSplCLib_Cache::IsCacheValid(Standard_Real theParameter) const
|
||||
{
|
||||
return myParams.IsCacheValid (theParameter);
|
||||
return myParams.IsCacheValid(theParameter);
|
||||
}
|
||||
|
||||
void BSplCLib_Cache::BuildCache(const Standard_Real& theParameter,
|
||||
const TColStd_Array1OfReal& theFlatKnots,
|
||||
const TColgp_Array1OfPnt2d& thePoles2d,
|
||||
const TColStd_Array1OfReal* theWeights)
|
||||
void BSplCLib_Cache::BuildCache(const Standard_Real& theParameter,
|
||||
const TColStd_Array1OfReal& theFlatKnots,
|
||||
const TColgp_Array1OfPnt2d& thePoles2d,
|
||||
const TColStd_Array1OfReal* theWeights)
|
||||
{
|
||||
// Normalize theParameter for periodical B-splines
|
||||
Standard_Real aNewParam = myParams.PeriodicNormalization (theParameter);
|
||||
myParams.LocateParameter (aNewParam, theFlatKnots);
|
||||
Standard_Real aNewParam = myParams.PeriodicNormalization(theParameter);
|
||||
myParams.LocateParameter(aNewParam, theFlatKnots);
|
||||
|
||||
// Calculate new cache data
|
||||
BSplCLib::BuildCache (myParams.SpanStart, myParams.SpanLength, myParams.IsPeriodic,
|
||||
myParams.Degree, myParams.SpanIndex, theFlatKnots, thePoles2d,
|
||||
theWeights, myPolesWeights->ChangeArray2());
|
||||
BSplCLib::BuildCache(myParams.SpanStart,
|
||||
myParams.SpanLength,
|
||||
myParams.IsPeriodic,
|
||||
myParams.Degree,
|
||||
myParams.SpanIndex,
|
||||
theFlatKnots,
|
||||
thePoles2d,
|
||||
theWeights,
|
||||
myPolesWeights->ChangeArray2());
|
||||
}
|
||||
|
||||
void BSplCLib_Cache::BuildCache(const Standard_Real& theParameter,
|
||||
const TColStd_Array1OfReal& theFlatKnots,
|
||||
const TColgp_Array1OfPnt& thePoles,
|
||||
const TColStd_Array1OfReal* theWeights)
|
||||
void BSplCLib_Cache::BuildCache(const Standard_Real& theParameter,
|
||||
const TColStd_Array1OfReal& theFlatKnots,
|
||||
const TColgp_Array1OfPnt& thePoles,
|
||||
const TColStd_Array1OfReal* theWeights)
|
||||
{
|
||||
// Create list of knots with repetitions and normalize theParameter for periodical B-splines
|
||||
Standard_Real aNewParam = myParams.PeriodicNormalization (theParameter);
|
||||
myParams.LocateParameter (aNewParam, theFlatKnots);
|
||||
Standard_Real aNewParam = myParams.PeriodicNormalization(theParameter);
|
||||
myParams.LocateParameter(aNewParam, theFlatKnots);
|
||||
|
||||
// Calculate new cache data
|
||||
BSplCLib::BuildCache (myParams.SpanStart, myParams.SpanLength, myParams.IsPeriodic,
|
||||
myParams.Degree, myParams.SpanIndex, theFlatKnots, thePoles,
|
||||
theWeights, myPolesWeights->ChangeArray2());
|
||||
BSplCLib::BuildCache(myParams.SpanStart,
|
||||
myParams.SpanLength,
|
||||
myParams.IsPeriodic,
|
||||
myParams.Degree,
|
||||
myParams.SpanIndex,
|
||||
theFlatKnots,
|
||||
thePoles,
|
||||
theWeights,
|
||||
myPolesWeights->ChangeArray2());
|
||||
}
|
||||
|
||||
void BSplCLib_Cache::CalculateDerivative(const Standard_Real& theParameter,
|
||||
const Standard_Integer& theDerivative,
|
||||
Standard_Real& theDerivArray) const
|
||||
void BSplCLib_Cache::CalculateDerivative(const Standard_Real& theParameter,
|
||||
const Standard_Integer& theDerivative,
|
||||
Standard_Real& theDerivArray) const
|
||||
{
|
||||
Standard_Real aNewParameter = myParams.PeriodicNormalization (theParameter);
|
||||
aNewParameter = (aNewParameter - myParams.SpanStart) / myParams.SpanLength;
|
||||
Standard_Real aNewParameter = myParams.PeriodicNormalization(theParameter);
|
||||
aNewParameter = (aNewParameter - myParams.SpanStart) / myParams.SpanLength;
|
||||
|
||||
Standard_Real* aPolesArray = ConvertArray(myPolesWeights);
|
||||
Standard_Integer aDimension = myPolesWeights->RowLength(); // number of columns
|
||||
Standard_Real* aPolesArray = ConvertArray(myPolesWeights);
|
||||
Standard_Integer aDimension = myPolesWeights->RowLength(); // number of columns
|
||||
|
||||
// Temporary container. The maximal size of this container is defined by:
|
||||
// 1) maximal derivative for cache evaluation, which is 3, plus one row for function values,
|
||||
// 1) maximal derivative for cache evaluation, which is 3, plus one row for function values,
|
||||
// 2) and maximal dimension of the point, which is 3, plus one column for weights.
|
||||
Standard_Real aTmpContainer[16];
|
||||
|
||||
@@ -113,17 +126,23 @@ void BSplCLib_Cache::CalculateDerivative(const Standard_Real& theParameter,
|
||||
if (!myIsRational && myParams.Degree < theDerivative)
|
||||
{
|
||||
aDerivative = myParams.Degree;
|
||||
for (Standard_Integer ind = myParams.Degree * aDimension; ind < (theDerivative + 1) * aDimension; ind++)
|
||||
for (Standard_Integer ind = myParams.Degree * aDimension;
|
||||
ind < (theDerivative + 1) * aDimension;
|
||||
ind++)
|
||||
{
|
||||
aPntDeriv[ind] = 0.0;
|
||||
// clang-format off
|
||||
// clang-format off
|
||||
(&theDerivArray)[ind] = 0.0; // should be cleared separately, because aPntDeriv may look to another memory area
|
||||
// clang-format on
|
||||
// clang-format on
|
||||
}
|
||||
}
|
||||
|
||||
PLib::EvalPolynomial(aNewParameter, aDerivative, myParams.Degree, aDimension,
|
||||
aPolesArray[0], aPntDeriv[0]);
|
||||
PLib::EvalPolynomial(aNewParameter,
|
||||
aDerivative,
|
||||
myParams.Degree,
|
||||
aDimension,
|
||||
aPolesArray[0],
|
||||
aPntDeriv[0]);
|
||||
// Unnormalize derivatives since those are computed normalized
|
||||
Standard_Real aFactor = 1.0;
|
||||
for (Standard_Integer deriv = 1; deriv <= aDerivative; deriv++)
|
||||
@@ -137,19 +156,21 @@ void BSplCLib_Cache::CalculateDerivative(const Standard_Real& theParameter,
|
||||
PLib::RationalDerivative(aDerivative, aDerivative, aDimension - 1, aPntDeriv[0], theDerivArray);
|
||||
}
|
||||
|
||||
|
||||
void BSplCLib_Cache::D0(const Standard_Real& theParameter, gp_Pnt2d& thePoint) const
|
||||
{
|
||||
Standard_Real aNewParameter = myParams.PeriodicNormalization (theParameter);
|
||||
aNewParameter = (aNewParameter - myParams.SpanStart) / myParams.SpanLength;
|
||||
Standard_Real aNewParameter = myParams.PeriodicNormalization(theParameter);
|
||||
aNewParameter = (aNewParameter - myParams.SpanStart) / myParams.SpanLength;
|
||||
|
||||
Standard_Real* aPolesArray = ConvertArray(myPolesWeights);
|
||||
Standard_Real aPoint[4];
|
||||
Standard_Real* aPolesArray = ConvertArray(myPolesWeights);
|
||||
Standard_Real aPoint[4];
|
||||
Standard_Integer aDimension = myPolesWeights->RowLength(); // number of columns
|
||||
|
||||
PLib::NoDerivativeEvalPolynomial(aNewParameter, myParams.Degree,
|
||||
aDimension, myParams.Degree * aDimension,
|
||||
aPolesArray[0], aPoint[0]);
|
||||
PLib::NoDerivativeEvalPolynomial(aNewParameter,
|
||||
myParams.Degree,
|
||||
aDimension,
|
||||
myParams.Degree * aDimension,
|
||||
aPolesArray[0],
|
||||
aPoint[0]);
|
||||
|
||||
thePoint.SetCoord(aPoint[0], aPoint[1]);
|
||||
if (myIsRational)
|
||||
@@ -158,27 +179,31 @@ void BSplCLib_Cache::D0(const Standard_Real& theParameter, gp_Pnt2d& thePoint) c
|
||||
|
||||
void BSplCLib_Cache::D0(const Standard_Real& theParameter, gp_Pnt& thePoint) const
|
||||
{
|
||||
Standard_Real aNewParameter = myParams.PeriodicNormalization (theParameter);
|
||||
aNewParameter = (aNewParameter - myParams.SpanStart) / myParams.SpanLength;
|
||||
Standard_Real aNewParameter = myParams.PeriodicNormalization(theParameter);
|
||||
aNewParameter = (aNewParameter - myParams.SpanStart) / myParams.SpanLength;
|
||||
|
||||
Standard_Real* aPolesArray = ConvertArray(myPolesWeights);
|
||||
Standard_Real aPoint[4];
|
||||
Standard_Real* aPolesArray = ConvertArray(myPolesWeights);
|
||||
Standard_Real aPoint[4];
|
||||
Standard_Integer aDimension = myPolesWeights->RowLength(); // number of columns
|
||||
|
||||
PLib::NoDerivativeEvalPolynomial(aNewParameter, myParams.Degree,
|
||||
aDimension, myParams.Degree * aDimension,
|
||||
aPolesArray[0], aPoint[0]);
|
||||
PLib::NoDerivativeEvalPolynomial(aNewParameter,
|
||||
myParams.Degree,
|
||||
aDimension,
|
||||
myParams.Degree * aDimension,
|
||||
aPolesArray[0],
|
||||
aPoint[0]);
|
||||
|
||||
thePoint.SetCoord(aPoint[0], aPoint[1], aPoint[2]);
|
||||
if (myIsRational)
|
||||
thePoint.ChangeCoord().Divide(aPoint[3]);
|
||||
}
|
||||
|
||||
|
||||
void BSplCLib_Cache::D1(const Standard_Real& theParameter, gp_Pnt2d& thePoint, gp_Vec2d& theTangent) const
|
||||
void BSplCLib_Cache::D1(const Standard_Real& theParameter,
|
||||
gp_Pnt2d& thePoint,
|
||||
gp_Vec2d& theTangent) const
|
||||
{
|
||||
Standard_Integer aDimension = myPolesWeights->RowLength(); // number of columns
|
||||
Standard_Real aPntDeriv[8]; // result storage (point and derivative coordinates)
|
||||
Standard_Real aPntDeriv[8]; // result storage (point and derivative coordinates)
|
||||
|
||||
this->CalculateDerivative(theParameter, 1, aPntDeriv[0]);
|
||||
if (myIsRational) // the size of aPntDeriv was changed by PLib::RationalDerivative
|
||||
@@ -188,10 +213,12 @@ void BSplCLib_Cache::D1(const Standard_Real& theParameter, gp_Pnt2d& thePoint, g
|
||||
theTangent.SetCoord(aPntDeriv[aDimension], aPntDeriv[aDimension + 1]);
|
||||
}
|
||||
|
||||
void BSplCLib_Cache::D1(const Standard_Real& theParameter, gp_Pnt& thePoint, gp_Vec& theTangent) const
|
||||
void BSplCLib_Cache::D1(const Standard_Real& theParameter,
|
||||
gp_Pnt& thePoint,
|
||||
gp_Vec& theTangent) const
|
||||
{
|
||||
Standard_Integer aDimension = myPolesWeights->RowLength(); // number of columns
|
||||
Standard_Real aPntDeriv[8]; // result storage (point and derivative coordinates)
|
||||
Standard_Real aPntDeriv[8]; // result storage (point and derivative coordinates)
|
||||
|
||||
this->CalculateDerivative(theParameter, 1, aPntDeriv[0]);
|
||||
if (myIsRational) // the size of aPntDeriv was changed by PLib::RationalDerivative
|
||||
@@ -201,10 +228,13 @@ void BSplCLib_Cache::D1(const Standard_Real& theParameter, gp_Pnt& thePoint, gp_
|
||||
theTangent.SetCoord(aPntDeriv[aDimension], aPntDeriv[aDimension + 1], aPntDeriv[aDimension + 2]);
|
||||
}
|
||||
|
||||
void BSplCLib_Cache::D2(const Standard_Real& theParameter, gp_Pnt2d& thePoint, gp_Vec2d& theTangent, gp_Vec2d& theCurvature) const
|
||||
void BSplCLib_Cache::D2(const Standard_Real& theParameter,
|
||||
gp_Pnt2d& thePoint,
|
||||
gp_Vec2d& theTangent,
|
||||
gp_Vec2d& theCurvature) const
|
||||
{
|
||||
Standard_Integer aDimension = myPolesWeights->RowLength(); // number of columns
|
||||
Standard_Real aPntDeriv[12]; // result storage (point and derivatives coordinates)
|
||||
Standard_Real aPntDeriv[12]; // result storage (point and derivatives coordinates)
|
||||
|
||||
this->CalculateDerivative(theParameter, 2, aPntDeriv[0]);
|
||||
if (myIsRational) // the size of aPntDeriv was changed by PLib::RationalDerivative
|
||||
@@ -212,13 +242,16 @@ void BSplCLib_Cache::D2(const Standard_Real& theParameter, gp_Pnt2d& thePoint, g
|
||||
|
||||
thePoint.SetCoord(aPntDeriv[0], aPntDeriv[1]);
|
||||
theTangent.SetCoord(aPntDeriv[aDimension], aPntDeriv[aDimension + 1]);
|
||||
theCurvature.SetCoord(aPntDeriv[aDimension<<1], aPntDeriv[(aDimension<<1) + 1]);
|
||||
theCurvature.SetCoord(aPntDeriv[aDimension << 1], aPntDeriv[(aDimension << 1) + 1]);
|
||||
}
|
||||
|
||||
void BSplCLib_Cache::D2(const Standard_Real& theParameter, gp_Pnt& thePoint, gp_Vec& theTangent, gp_Vec& theCurvature) const
|
||||
void BSplCLib_Cache::D2(const Standard_Real& theParameter,
|
||||
gp_Pnt& thePoint,
|
||||
gp_Vec& theTangent,
|
||||
gp_Vec& theCurvature) const
|
||||
{
|
||||
Standard_Integer aDimension = myPolesWeights->RowLength(); // number of columns
|
||||
Standard_Real aPntDeriv[12]; // result storage (point and derivatives coordinates)
|
||||
Standard_Real aPntDeriv[12]; // result storage (point and derivatives coordinates)
|
||||
|
||||
this->CalculateDerivative(theParameter, 2, aPntDeriv[0]);
|
||||
if (myIsRational) // the size of aPntDeriv was changed by PLib::RationalDerivative
|
||||
@@ -226,18 +259,19 @@ void BSplCLib_Cache::D2(const Standard_Real& theParameter, gp_Pnt& thePoint, gp_
|
||||
|
||||
thePoint.SetCoord(aPntDeriv[0], aPntDeriv[1], aPntDeriv[2]);
|
||||
theTangent.SetCoord(aPntDeriv[aDimension], aPntDeriv[aDimension + 1], aPntDeriv[aDimension + 2]);
|
||||
theCurvature.SetCoord(aPntDeriv[aDimension<<1], aPntDeriv[(aDimension<<1) + 1], aPntDeriv[(aDimension<<1) + 2]);
|
||||
theCurvature.SetCoord(aPntDeriv[aDimension << 1],
|
||||
aPntDeriv[(aDimension << 1) + 1],
|
||||
aPntDeriv[(aDimension << 1) + 2]);
|
||||
}
|
||||
|
||||
|
||||
void BSplCLib_Cache::D3(const Standard_Real& theParameter,
|
||||
gp_Pnt2d& thePoint,
|
||||
gp_Vec2d& theTangent,
|
||||
gp_Vec2d& theCurvature,
|
||||
gp_Vec2d& theTorsion) const
|
||||
void BSplCLib_Cache::D3(const Standard_Real& theParameter,
|
||||
gp_Pnt2d& thePoint,
|
||||
gp_Vec2d& theTangent,
|
||||
gp_Vec2d& theCurvature,
|
||||
gp_Vec2d& theTorsion) const
|
||||
{
|
||||
Standard_Integer aDimension = myPolesWeights->RowLength(); // number of columns
|
||||
Standard_Real aPntDeriv[16]; // result storage (point and derivatives coordinates)
|
||||
Standard_Real aPntDeriv[16]; // result storage (point and derivatives coordinates)
|
||||
|
||||
this->CalculateDerivative(theParameter, 3, aPntDeriv[0]);
|
||||
if (myIsRational) // the size of aPntDeriv was changed by PLib::RationalDerivative
|
||||
@@ -251,14 +285,14 @@ void BSplCLib_Cache::D3(const Standard_Real& theParameter,
|
||||
theTorsion.SetCoord(aPntDeriv[aShift], aPntDeriv[aShift + 1]);
|
||||
}
|
||||
|
||||
void BSplCLib_Cache::D3(const Standard_Real& theParameter,
|
||||
gp_Pnt& thePoint,
|
||||
gp_Vec& theTangent,
|
||||
gp_Vec& theCurvature,
|
||||
gp_Vec& theTorsion) const
|
||||
void BSplCLib_Cache::D3(const Standard_Real& theParameter,
|
||||
gp_Pnt& thePoint,
|
||||
gp_Vec& theTangent,
|
||||
gp_Vec& theCurvature,
|
||||
gp_Vec& theTorsion) const
|
||||
{
|
||||
Standard_Integer aDimension = myPolesWeights->RowLength(); // number of columns
|
||||
Standard_Real aPntDeriv[16]; // result storage (point and derivatives coordinates)
|
||||
Standard_Real aPntDeriv[16]; // result storage (point and derivatives coordinates)
|
||||
|
||||
this->CalculateDerivative(theParameter, 3, aPntDeriv[0]);
|
||||
if (myIsRational) // the size of aPntDeriv was changed by PLib::RationalDerivative
|
||||
@@ -271,4 +305,3 @@ void BSplCLib_Cache::D3(const Standard_Real& theParameter,
|
||||
aShift += aDimension;
|
||||
theTorsion.SetCoord(aPntDeriv[aShift], aPntDeriv[aShift + 1], aPntDeriv[aShift + 2]);
|
||||
}
|
||||
|
||||
|
@@ -24,18 +24,17 @@
|
||||
class BSplCLib_Cache : public Standard_Transient
|
||||
{
|
||||
public:
|
||||
|
||||
//! Constructor, prepares data structures for caching values on a 2d curve.
|
||||
//! \param theDegree degree of the curve
|
||||
//! \param thePeriodic identify whether the curve is periodic
|
||||
//! \param theFlatKnots knots of Bezier/B-spline curve (with repetitions)
|
||||
//! \param thePoles2d array of poles of 2D curve
|
||||
//! \param theWeights array of weights of corresponding poles
|
||||
Standard_EXPORT BSplCLib_Cache(const Standard_Integer& theDegree,
|
||||
const Standard_Boolean& thePeriodic,
|
||||
const TColStd_Array1OfReal& theFlatKnots,
|
||||
const TColgp_Array1OfPnt2d& thePoles2d,
|
||||
const TColStd_Array1OfReal* theWeights = NULL);
|
||||
Standard_EXPORT BSplCLib_Cache(const Standard_Integer& theDegree,
|
||||
const Standard_Boolean& thePeriodic,
|
||||
const TColStd_Array1OfReal& theFlatKnots,
|
||||
const TColgp_Array1OfPnt2d& thePoles2d,
|
||||
const TColStd_Array1OfReal* theWeights = NULL);
|
||||
|
||||
//! Constructor, prepares data structures for caching values on a 3d curve.
|
||||
//! \param theDegree degree of the curve
|
||||
@@ -43,11 +42,11 @@ public:
|
||||
//! \param theFlatKnots knots of Bezier/B-spline curve (with repetitions)
|
||||
//! \param thePoles array of poles of 3D curve
|
||||
//! \param theWeights array of weights of corresponding poles
|
||||
Standard_EXPORT BSplCLib_Cache(const Standard_Integer& theDegree,
|
||||
const Standard_Boolean& thePeriodic,
|
||||
const TColStd_Array1OfReal& theFlatKnots,
|
||||
const TColgp_Array1OfPnt& thePoles,
|
||||
const TColStd_Array1OfReal* theWeights = NULL);
|
||||
Standard_EXPORT BSplCLib_Cache(const Standard_Integer& theDegree,
|
||||
const Standard_Boolean& thePeriodic,
|
||||
const TColStd_Array1OfReal& theFlatKnots,
|
||||
const TColgp_Array1OfPnt& thePoles,
|
||||
const TColStd_Array1OfReal* theWeights = NULL);
|
||||
|
||||
//! Verifies validity of the cache using flat parameter of the point
|
||||
//! \param theParameter parameter of the point placed in the span
|
||||
@@ -58,85 +57,91 @@ public:
|
||||
//! \param theFlatKnots knots of Bezier/B-spline curve (with repetitions)
|
||||
//! \param thePoles2d array of poles of 2D curve
|
||||
//! \param theWeights array of weights of corresponding poles
|
||||
Standard_EXPORT void BuildCache(const Standard_Real& theParameter,
|
||||
const TColStd_Array1OfReal& theFlatKnots,
|
||||
const TColgp_Array1OfPnt2d& thePoles2d,
|
||||
const TColStd_Array1OfReal* theWeights);
|
||||
Standard_EXPORT void BuildCache(const Standard_Real& theParameter,
|
||||
const TColStd_Array1OfReal& theFlatKnots,
|
||||
const TColgp_Array1OfPnt2d& thePoles2d,
|
||||
const TColStd_Array1OfReal* theWeights);
|
||||
|
||||
//! Recomputes the cache data for 3D curves. Does not verify validity of the cache
|
||||
//! \param theParameter the value on the knot's axis to identify the span
|
||||
//! \param theFlatKnots knots of Bezier/B-spline curve (with repetitions)
|
||||
//! \param thePoles array of poles of 3D curve
|
||||
//! \param theWeights array of weights of corresponding poles
|
||||
Standard_EXPORT void BuildCache(const Standard_Real& theParameter,
|
||||
const TColStd_Array1OfReal& theFlatKnots,
|
||||
const TColgp_Array1OfPnt& thePoles,
|
||||
const TColStd_Array1OfReal* theWeights = NULL);
|
||||
Standard_EXPORT void BuildCache(const Standard_Real& theParameter,
|
||||
const TColStd_Array1OfReal& theFlatKnots,
|
||||
const TColgp_Array1OfPnt& thePoles,
|
||||
const TColStd_Array1OfReal* theWeights = NULL);
|
||||
|
||||
//! Calculates the point on the curve in the specified parameter
|
||||
//! \param[in] theParameter parameter of calculation of the value
|
||||
//! \param[out] thePoint the result of calculation (the point on the curve)
|
||||
Standard_EXPORT void D0(const Standard_Real& theParameter, gp_Pnt2d& thePoint) const;
|
||||
Standard_EXPORT void D0(const Standard_Real& theParameter, gp_Pnt& thePoint) const;
|
||||
Standard_EXPORT void D0(const Standard_Real& theParameter, gp_Pnt& thePoint) const;
|
||||
|
||||
//! Calculates the point on the curve and its first derivative in the specified parameter
|
||||
//! \param[in] theParameter parameter of calculation of the value
|
||||
//! \param[out] thePoint the result of calculation (the point on the curve)
|
||||
//! \param[out] theTangent tangent vector (first derivatives) for the curve in the calculated point
|
||||
Standard_EXPORT void D1(const Standard_Real& theParameter, gp_Pnt2d& thePoint, gp_Vec2d& theTangent) const;
|
||||
Standard_EXPORT void D1(const Standard_Real& theParameter, gp_Pnt& thePoint, gp_Vec& theTangent) const;
|
||||
//! \param[out] theTangent tangent vector (first derivatives) for the curve in the calculated
|
||||
//! point
|
||||
Standard_EXPORT void D1(const Standard_Real& theParameter,
|
||||
gp_Pnt2d& thePoint,
|
||||
gp_Vec2d& theTangent) const;
|
||||
Standard_EXPORT void D1(const Standard_Real& theParameter,
|
||||
gp_Pnt& thePoint,
|
||||
gp_Vec& theTangent) const;
|
||||
|
||||
//! Calculates the point on the curve and two derivatives in the specified parameter
|
||||
//! \param[in] theParameter parameter of calculation of the value
|
||||
//! \param[out] thePoint the result of calculation (the point on the curve)
|
||||
//! \param[out] theTangent tangent vector (1st derivatives) for the curve in the calculated point
|
||||
//! \param[out] theCurvature curvature vector (2nd derivatives) for the curve in the calculated point
|
||||
Standard_EXPORT void D2(const Standard_Real& theParameter,
|
||||
gp_Pnt2d& thePoint,
|
||||
gp_Vec2d& theTangent,
|
||||
gp_Vec2d& theCurvature) const;
|
||||
Standard_EXPORT void D2(const Standard_Real& theParameter,
|
||||
gp_Pnt& thePoint,
|
||||
gp_Vec& theTangent,
|
||||
gp_Vec& theCurvature) const;
|
||||
//! \param[out] theTangent tangent vector (1st derivatives) for the curve in the calculated
|
||||
//! point \param[out] theCurvature curvature vector (2nd derivatives) for the curve in the
|
||||
//! calculated point
|
||||
Standard_EXPORT void D2(const Standard_Real& theParameter,
|
||||
gp_Pnt2d& thePoint,
|
||||
gp_Vec2d& theTangent,
|
||||
gp_Vec2d& theCurvature) const;
|
||||
Standard_EXPORT void D2(const Standard_Real& theParameter,
|
||||
gp_Pnt& thePoint,
|
||||
gp_Vec& theTangent,
|
||||
gp_Vec& theCurvature) const;
|
||||
|
||||
//! Calculates the point on the curve and three derivatives in the specified parameter
|
||||
//! \param[in] theParameter parameter of calculation of the value
|
||||
//! \param[out] thePoint the result of calculation (the point on the curve)
|
||||
//! \param[out] theTangent tangent vector (1st derivatives) for the curve in the calculated point
|
||||
//! \param[out] theCurvature curvature vector (2nd derivatives) for the curve in the calculated point
|
||||
//! \param[out] theTorsion second curvature vector (3rd derivatives) for the curve in the calculated point
|
||||
Standard_EXPORT void D3(const Standard_Real& theParameter,
|
||||
gp_Pnt2d& thePoint,
|
||||
gp_Vec2d& theTangent,
|
||||
gp_Vec2d& theCurvature,
|
||||
gp_Vec2d& theTorsion) const;
|
||||
Standard_EXPORT void D3(const Standard_Real& theParameter,
|
||||
gp_Pnt& thePoint,
|
||||
gp_Vec& theTangent,
|
||||
gp_Vec& theCurvature,
|
||||
gp_Vec& theTorsion) const;
|
||||
//! \param[out] theTangent tangent vector (1st derivatives) for the curve in the calculated
|
||||
//! point \param[out] theCurvature curvature vector (2nd derivatives) for the curve in the
|
||||
//! calculated point \param[out] theTorsion second curvature vector (3rd derivatives) for the
|
||||
//! curve in the calculated point
|
||||
Standard_EXPORT void D3(const Standard_Real& theParameter,
|
||||
gp_Pnt2d& thePoint,
|
||||
gp_Vec2d& theTangent,
|
||||
gp_Vec2d& theCurvature,
|
||||
gp_Vec2d& theTorsion) const;
|
||||
Standard_EXPORT void D3(const Standard_Real& theParameter,
|
||||
gp_Pnt& thePoint,
|
||||
gp_Vec& theTangent,
|
||||
gp_Vec& theCurvature,
|
||||
gp_Vec& theTorsion) const;
|
||||
|
||||
|
||||
DEFINE_STANDARD_RTTIEXT(BSplCLib_Cache,Standard_Transient)
|
||||
DEFINE_STANDARD_RTTIEXT(BSplCLib_Cache, Standard_Transient)
|
||||
|
||||
protected:
|
||||
|
||||
//! Fills array of derivatives in the selected point of the curve
|
||||
//! \param[in] theParameter parameter of the calculation
|
||||
//! \param[in] theDerivative maximal derivative to be calculated (computes all derivatives lesser than specified)
|
||||
//! \param[out] theDerivArray result array of derivatives (with size (theDerivative+1)*(PntDim+1),
|
||||
//! \param[in] theDerivative maximal derivative to be calculated (computes all derivatives lesser
|
||||
//! than specified) \param[out] theDerivArray result array of derivatives (with size
|
||||
//! (theDerivative+1)*(PntDim+1),
|
||||
//! where PntDim = 2 or 3 is a dimension of the curve)
|
||||
void CalculateDerivative(const Standard_Real& theParameter,
|
||||
const Standard_Integer& theDerivative,
|
||||
Standard_Real& theDerivArray) const;
|
||||
void CalculateDerivative(const Standard_Real& theParameter,
|
||||
const Standard_Integer& theDerivative,
|
||||
Standard_Real& theDerivArray) const;
|
||||
|
||||
// copying is prohibited
|
||||
BSplCLib_Cache (const BSplCLib_Cache&);
|
||||
void operator = (const BSplCLib_Cache&);
|
||||
BSplCLib_Cache(const BSplCLib_Cache&);
|
||||
void operator=(const BSplCLib_Cache&);
|
||||
|
||||
private:
|
||||
// clang-format off
|
||||
// clang-format off
|
||||
Standard_Boolean myIsRational; //!< identifies the rationality of Bezier/B-spline curve
|
||||
BSplCLib_CacheParams myParams; //!< cache parameters
|
||||
Handle(TColStd_HArray2OfReal) myPolesWeights; //!< array of poles and weights of calculated cache
|
||||
@@ -144,7 +149,7 @@ private:
|
||||
// x1 y1 [z1] [w1]
|
||||
// x2 y2 [z2] [w2] etc
|
||||
// for 2D-curves there is no z conponent, for non-rational curves there is no weight
|
||||
// clang-format on
|
||||
// clang-format on
|
||||
};
|
||||
|
||||
DEFINE_STANDARD_HANDLE(BSplCLib_Cache, Standard_Transient)
|
||||
|
@@ -21,51 +21,53 @@
|
||||
//! and data of the current span for its caching
|
||||
struct BSplCLib_CacheParams
|
||||
{
|
||||
const Standard_Integer Degree; ///< degree of Bezier/B-spline
|
||||
const Standard_Boolean IsPeriodic; ///< true of the B-spline is periodic
|
||||
const Standard_Real FirstParameter; ///< first valid parameter
|
||||
const Standard_Real LastParameter; ///< last valid parameter
|
||||
const Standard_Integer Degree; ///< degree of Bezier/B-spline
|
||||
const Standard_Boolean IsPeriodic; ///< true of the B-spline is periodic
|
||||
const Standard_Real FirstParameter; ///< first valid parameter
|
||||
const Standard_Real LastParameter; ///< last valid parameter
|
||||
|
||||
const Standard_Integer SpanIndexMin; ///< minimal index of span
|
||||
const Standard_Integer SpanIndexMax; ///< maximal index of span
|
||||
|
||||
Standard_Real SpanStart; ///< parameter for the frst point of the span
|
||||
Standard_Real SpanLength; ///< length of the span
|
||||
Standard_Integer SpanIndex; ///< index of the span
|
||||
Standard_Real SpanStart; ///< parameter for the frst point of the span
|
||||
Standard_Real SpanLength; ///< length of the span
|
||||
Standard_Integer SpanIndex; ///< index of the span
|
||||
|
||||
//! Constructor, prepares data structures for caching.
|
||||
//! \param theDegree degree of the B-spline (or Bezier)
|
||||
//! \param thePeriodic identify whether the B-spline is periodic
|
||||
//! \param theFlatKnots knots of Bezier / B-spline parameterization
|
||||
BSplCLib_CacheParams (Standard_Integer theDegree, Standard_Boolean thePeriodic,
|
||||
const TColStd_Array1OfReal& theFlatKnots)
|
||||
: Degree(theDegree),
|
||||
IsPeriodic(thePeriodic),
|
||||
FirstParameter(theFlatKnots.Value(theFlatKnots.Lower() + theDegree)),
|
||||
LastParameter(theFlatKnots.Value(theFlatKnots.Upper() - theDegree)),
|
||||
SpanIndexMin(theFlatKnots.Lower() + theDegree),
|
||||
SpanIndexMax(theFlatKnots.Upper() - theDegree - 1),
|
||||
SpanStart(0.),
|
||||
SpanLength(0.),
|
||||
SpanIndex(0)
|
||||
{}
|
||||
BSplCLib_CacheParams(Standard_Integer theDegree,
|
||||
Standard_Boolean thePeriodic,
|
||||
const TColStd_Array1OfReal& theFlatKnots)
|
||||
: Degree(theDegree),
|
||||
IsPeriodic(thePeriodic),
|
||||
FirstParameter(theFlatKnots.Value(theFlatKnots.Lower() + theDegree)),
|
||||
LastParameter(theFlatKnots.Value(theFlatKnots.Upper() - theDegree)),
|
||||
SpanIndexMin(theFlatKnots.Lower() + theDegree),
|
||||
SpanIndexMax(theFlatKnots.Upper() - theDegree - 1),
|
||||
SpanStart(0.),
|
||||
SpanLength(0.),
|
||||
SpanIndex(0)
|
||||
{
|
||||
}
|
||||
|
||||
//! Normalizes the parameter for periodic B-splines
|
||||
//! \param theParameter the value to be normalized into the knots array
|
||||
Standard_Real PeriodicNormalization (Standard_Real theParameter) const
|
||||
Standard_Real PeriodicNormalization(Standard_Real theParameter) const
|
||||
{
|
||||
if (IsPeriodic)
|
||||
{
|
||||
if (theParameter < FirstParameter)
|
||||
{
|
||||
Standard_Real aPeriod = LastParameter - FirstParameter;
|
||||
Standard_Real aScale = IntegerPart ((FirstParameter - theParameter) / aPeriod);
|
||||
Standard_Real aScale = IntegerPart((FirstParameter - theParameter) / aPeriod);
|
||||
return theParameter + aPeriod * (aScale + 1.0);
|
||||
}
|
||||
if (theParameter > LastParameter)
|
||||
{
|
||||
Standard_Real aPeriod = LastParameter - FirstParameter;
|
||||
Standard_Real aScale = IntegerPart ((theParameter - LastParameter) / aPeriod);
|
||||
Standard_Real aScale = IntegerPart((theParameter - LastParameter) / aPeriod);
|
||||
return theParameter - aPeriod * (aScale + 1.0);
|
||||
}
|
||||
}
|
||||
@@ -74,30 +76,35 @@ struct BSplCLib_CacheParams
|
||||
|
||||
//! Verifies validity of the cache using flat parameter of the point
|
||||
//! \param theParameter parameter of the point placed in the span
|
||||
Standard_Boolean IsCacheValid (Standard_Real theParameter) const
|
||||
Standard_Boolean IsCacheValid(Standard_Real theParameter) const
|
||||
{
|
||||
Standard_Real aNewParam = PeriodicNormalization (theParameter);
|
||||
Standard_Real aDelta = aNewParam - SpanStart;
|
||||
return ((aDelta >= 0.0 || SpanIndex == SpanIndexMin) &&
|
||||
(aDelta < SpanLength || SpanIndex == SpanIndexMax));
|
||||
Standard_Real aNewParam = PeriodicNormalization(theParameter);
|
||||
Standard_Real aDelta = aNewParam - SpanStart;
|
||||
return ((aDelta >= 0.0 || SpanIndex == SpanIndexMin)
|
||||
&& (aDelta < SpanLength || SpanIndex == SpanIndexMax));
|
||||
}
|
||||
|
||||
//! Computes span for the specified parameter
|
||||
//! \param theParameter parameter of the point placed in the span
|
||||
//! \param theFlatKnots knots of Bezier / B-spline parameterization
|
||||
void LocateParameter (Standard_Real& theParameter, const TColStd_Array1OfReal& theFlatKnots)
|
||||
void LocateParameter(Standard_Real& theParameter, const TColStd_Array1OfReal& theFlatKnots)
|
||||
{
|
||||
SpanIndex = 0;
|
||||
BSplCLib::LocateParameter (Degree, theFlatKnots, BSplCLib::NoMults(),
|
||||
theParameter, IsPeriodic, SpanIndex, theParameter);
|
||||
BSplCLib::LocateParameter(Degree,
|
||||
theFlatKnots,
|
||||
BSplCLib::NoMults(),
|
||||
theParameter,
|
||||
IsPeriodic,
|
||||
SpanIndex,
|
||||
theParameter);
|
||||
SpanStart = theFlatKnots.Value(SpanIndex);
|
||||
SpanLength = theFlatKnots.Value(SpanIndex + 1) - SpanStart;
|
||||
}
|
||||
|
||||
private:
|
||||
// copying is prohibited
|
||||
BSplCLib_CacheParams (const BSplCLib_CacheParams&);
|
||||
void operator = (const BSplCLib_CacheParams&);
|
||||
BSplCLib_CacheParams(const BSplCLib_CacheParams&);
|
||||
void operator=(const BSplCLib_CacheParams&);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -28,37 +28,35 @@
|
||||
class BSplCLib_EvaluatorFunction
|
||||
{
|
||||
public:
|
||||
|
||||
//! Empty constructor
|
||||
BSplCLib_EvaluatorFunction () {}
|
||||
BSplCLib_EvaluatorFunction() {}
|
||||
|
||||
//! Destructor should be declared as virtual
|
||||
virtual ~BSplCLib_EvaluatorFunction () {}
|
||||
virtual ~BSplCLib_EvaluatorFunction() {}
|
||||
|
||||
//! Function evaluation method to be defined by descendant
|
||||
virtual void Evaluate (const Standard_Integer theDerivativeRequest,
|
||||
const Standard_Real* theStartEnd,
|
||||
const Standard_Real theParameter,
|
||||
Standard_Real& theResult,
|
||||
Standard_Integer& theErrorCode) const = 0;
|
||||
virtual void Evaluate(const Standard_Integer theDerivativeRequest,
|
||||
const Standard_Real* theStartEnd,
|
||||
const Standard_Real theParameter,
|
||||
Standard_Real& theResult,
|
||||
Standard_Integer& theErrorCode) const = 0;
|
||||
|
||||
//! Shortcut for function-call style usage
|
||||
void operator () (const Standard_Integer theDerivativeRequest,
|
||||
const Standard_Real* theStartEnd,
|
||||
const Standard_Real theParameter,
|
||||
Standard_Real& theResult,
|
||||
Standard_Integer& theErrorCode) const
|
||||
void operator()(const Standard_Integer theDerivativeRequest,
|
||||
const Standard_Real* theStartEnd,
|
||||
const Standard_Real theParameter,
|
||||
Standard_Real& theResult,
|
||||
Standard_Integer& theErrorCode) const
|
||||
{
|
||||
Evaluate (theDerivativeRequest, theStartEnd, theParameter, theResult, theErrorCode);
|
||||
Evaluate(theDerivativeRequest, theStartEnd, theParameter, theResult, theErrorCode);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
//! Copy constructor is declared private to forbid copying
|
||||
BSplCLib_EvaluatorFunction (const BSplCLib_EvaluatorFunction&) {}
|
||||
BSplCLib_EvaluatorFunction(const BSplCLib_EvaluatorFunction&) {}
|
||||
|
||||
//! Assignment operator is declared private to forbid copying
|
||||
void operator = (const BSplCLib_EvaluatorFunction&) {}
|
||||
void operator=(const BSplCLib_EvaluatorFunction&) {}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -24,8 +24,8 @@
|
||||
//! <NonUniform>
|
||||
enum BSplCLib_KnotDistribution
|
||||
{
|
||||
BSplCLib_NonUniform,
|
||||
BSplCLib_Uniform
|
||||
BSplCLib_NonUniform,
|
||||
BSplCLib_Uniform
|
||||
};
|
||||
|
||||
#endif // _BSplCLib_KnotDistribution_HeaderFile
|
||||
|
@@ -30,9 +30,9 @@
|
||||
//! NonConstant in other cases.
|
||||
enum BSplCLib_MultDistribution
|
||||
{
|
||||
BSplCLib_NonConstant,
|
||||
BSplCLib_Constant,
|
||||
BSplCLib_QuasiConstant
|
||||
BSplCLib_NonConstant,
|
||||
BSplCLib_Constant,
|
||||
BSplCLib_QuasiConstant
|
||||
};
|
||||
|
||||
#endif // _BSplCLib_MultDistribution_HeaderFile
|
||||
|
Reference in New Issue
Block a user