Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions
BSplCLib_Cache Class Reference

A cache class for Bezier and B-spline curves. More...

#include <BSplCLib_Cache.hxx>

Inheritance diagram for BSplCLib_Cache:
Inheritance graph
[legend]

Public Member Functions

 BSplCLib_Cache (const int &theDegree, const bool &thePeriodic, const NCollection_Array1< double > &theFlatKnots, const NCollection_Array1< gp_Pnt2d > &thePoles2d, const NCollection_Array1< double > *theWeights=nullptr)
 Constructor, prepares data structures for caching values on a 2d curve.
 
 BSplCLib_Cache (const int &theDegree, const bool &thePeriodic, const NCollection_Array1< double > &theFlatKnots, const NCollection_Array1< gp_Pnt > &thePoles, const NCollection_Array1< double > *theWeights=nullptr)
 Constructor, prepares data structures for caching values on a 3d curve.
 
bool IsCacheValid (double theParameter) const
 Verifies validity of the cache using flat parameter of the point.
 
void BuildCache (const double &theParameter, const NCollection_Array1< double > &theFlatKnots, const NCollection_Array1< gp_Pnt2d > &thePoles2d, const NCollection_Array1< double > *theWeights)
 Recomputes the cache data for 2D curves. Does not verify validity of the cache.
 
void BuildCache (const double &theParameter, const NCollection_Array1< double > &theFlatKnots, const NCollection_Array1< gp_Pnt > &thePoles, const NCollection_Array1< double > *theWeights=nullptr)
 Recomputes the cache data for 3D curves. Does not verify validity of the cache.
 
void D0 (const double &theParameter, gp_Pnt2d &thePoint) const
 Calculates the point on the curve in the specified parameter.
 
void D0 (const double &theParameter, gp_Pnt &thePoint) const
 
void D1 (const double &theParameter, gp_Pnt2d &thePoint, gp_Vec2d &theTangent) const
 Calculates the point on the curve and its first derivative in the specified parameter.
 
void D1 (const double &theParameter, gp_Pnt &thePoint, gp_Vec &theTangent) const
 
void D2 (const double &theParameter, gp_Pnt2d &thePoint, gp_Vec2d &theTangent, gp_Vec2d &theCurvature) const
 Calculates the point on the curve and two derivatives in the specified parameter.
 
void D2 (const double &theParameter, gp_Pnt &thePoint, gp_Vec &theTangent, gp_Vec &theCurvature) const
 
void D3 (const double &theParameter, gp_Pnt2d &thePoint, gp_Vec2d &theTangent, gp_Vec2d &theCurvature, gp_Vec2d &theTorsion) const
 Calculates the point on the curve and three derivatives in the specified parameter.
 
void D3 (const double &theParameter, gp_Pnt &thePoint, gp_Vec &theTangent, gp_Vec &theCurvature, gp_Vec &theTorsion) const
 
void D0Local (double theLocalParam, gp_Pnt &thePoint) const
 Calculates the 3D point using pre-computed local parameter in [0, 1] range. This bypasses periodic normalization and local parameter calculation.
 
void D1Local (double theLocalParam, gp_Pnt &thePoint, gp_Vec &theTangent) const
 Calculates the 3D point and first derivative using pre-computed local parameter.
 
void D2Local (double theLocalParam, gp_Pnt &thePoint, gp_Vec &theTangent, gp_Vec &theCurvature) const
 Calculates the 3D point, first and second derivatives using pre-computed local parameter.
 
void D3Local (double theLocalParam, gp_Pnt &thePoint, gp_Vec &theTangent, gp_Vec &theCurvature, gp_Vec &theTorsion) const
 Calculates the 3D point, first, second and third derivatives using pre-computed local parameter.
 
void D0Local (double theLocalParam, gp_Pnt2d &thePoint) const
 Calculates the 2D point using pre-computed local parameter in [0, 1] range. This bypasses periodic normalization and local parameter calculation.
 
void D1Local (double theLocalParam, gp_Pnt2d &thePoint, gp_Vec2d &theTangent) const
 Calculates the 2D point and first derivative using pre-computed local parameter.
 
void D2Local (double theLocalParam, gp_Pnt2d &thePoint, gp_Vec2d &theTangent, gp_Vec2d &theCurvature) const
 Calculates the 2D point, first and second derivatives using pre-computed local parameter.
 
void D3Local (double theLocalParam, gp_Pnt2d &thePoint, gp_Vec2d &theTangent, gp_Vec2d &theCurvature, gp_Vec2d &theTorsion) const
 Calculates the 2D point, first, second and third derivatives using pre-computed local parameter.
 
- Public Member Functions inherited from Standard_Transient
 Standard_Transient ()
 Empty constructor.
 
 Standard_Transient (const Standard_Transient &)
 Copy constructor – does nothing.
 
Standard_Transientoperator= (const Standard_Transient &)
 Assignment operator, needed to avoid copying reference counter.
 
virtual ~Standard_Transient ()=default
 Destructor must be virtual.
 
virtual const opencascade::handle< Standard_Type > & DynamicType () const
 Returns a type descriptor about this object.
 
bool IsInstance (const opencascade::handle< Standard_Type > &theType) const
 Returns a true value if this is an instance of Type.
 
bool IsInstance (const char *const theTypeName) const
 Returns a true value if this is an instance of TypeName.
 
bool IsKind (const opencascade::handle< Standard_Type > &theType) const
 Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
 
bool IsKind (const char *const theTypeName) const
 Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
 
Standard_TransientThis () const
 Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero.
 
int GetRefCount () const noexcept
 Get the reference counter of this object.
 
void IncrementRefCounter () noexcept
 Increments the reference counter of this object. Uses relaxed memory ordering since incrementing only requires atomicity, not synchronization with other memory operations.
 
int DecrementRefCounter () noexcept
 Decrements the reference counter of this object; returns the decremented value. Uses release ordering for the decrement to ensure all writes to the object are visible before the count reaches zero. An acquire fence is added only when the count reaches zero, ensuring proper synchronization before deletion. This is more efficient than using acq_rel for every decrement.
 
virtual void Delete () const
 Memory deallocator for transient classes.
 

Protected Member Functions

void calculateDerivative (double theParameter, int theDerivative, double *theDerivArray) const
 Fills array of derivatives in the selected point of the curve.
 
void calculateDerivativeLocal (double theLocalParam, int theDerivative, double *theDerivArray) const
 Fills array of derivatives using pre-computed local parameter.
 
 BSplCLib_Cache (const BSplCLib_Cache &)=delete
 
void operator= (const BSplCLib_Cache &)=delete
 

Additional Inherited Members

- Public Types inherited from Standard_Transient
typedef void base_type
 Returns a type descriptor about this object.
 
- Static Public Member Functions inherited from Standard_Transient
static constexpr const charget_type_name ()
 Returns a type descriptor about this object.
 
static const opencascade::handle< Standard_Type > & get_type_descriptor ()
 Returns type descriptor of Standard_Transient class.
 

Detailed Description

A cache class for Bezier and B-spline curves.

Defines all data, that can be cached on a span of a curve. The data should be recalculated in going from span to span.

Constructor & Destructor Documentation

◆ BSplCLib_Cache() [1/3]

BSplCLib_Cache::BSplCLib_Cache ( const int & theDegree,
const bool & thePeriodic,
const NCollection_Array1< double > & theFlatKnots,
const NCollection_Array1< gp_Pnt2d > & thePoles2d,
const NCollection_Array1< double > * theWeights = nullptr )

Constructor, prepares data structures for caching values on a 2d curve.

Parameters
theDegreedegree of the curve
thePeriodicidentify whether the curve is periodic
theFlatKnotsknots of Bezier/B-spline curve (with repetitions)
thePoles2darray of poles of 2D curve
theWeightsarray of weights of corresponding poles

◆ BSplCLib_Cache() [2/3]

BSplCLib_Cache::BSplCLib_Cache ( const int & theDegree,
const bool & thePeriodic,
const NCollection_Array1< double > & theFlatKnots,
const NCollection_Array1< gp_Pnt > & thePoles,
const NCollection_Array1< double > * theWeights = nullptr )

Constructor, prepares data structures for caching values on a 3d curve.

Parameters
theDegreedegree of the curve
thePeriodicidentify whether the curve is periodic
theFlatKnotsknots of Bezier/B-spline curve (with repetitions)
thePolesarray of poles of 3D curve
theWeightsarray of weights of corresponding poles

◆ BSplCLib_Cache() [3/3]

BSplCLib_Cache::BSplCLib_Cache ( const BSplCLib_Cache & )
protecteddelete

Member Function Documentation

◆ BuildCache() [1/2]

void BSplCLib_Cache::BuildCache ( const double & theParameter,
const NCollection_Array1< double > & theFlatKnots,
const NCollection_Array1< gp_Pnt > & thePoles,
const NCollection_Array1< double > * theWeights = nullptr )

Recomputes the cache data for 3D curves. Does not verify validity of the cache.

Parameters
theParameterthe value on the knot's axis to identify the span
theFlatKnotsknots of Bezier/B-spline curve (with repetitions)
thePolesarray of poles of 3D curve
theWeightsarray of weights of corresponding poles

◆ BuildCache() [2/2]

void BSplCLib_Cache::BuildCache ( const double & theParameter,
const NCollection_Array1< double > & theFlatKnots,
const NCollection_Array1< gp_Pnt2d > & thePoles2d,
const NCollection_Array1< double > * theWeights )

Recomputes the cache data for 2D curves. Does not verify validity of the cache.

Parameters
theParameterthe value on the knot's axis to identify the span
theFlatKnotsknots of Bezier/B-spline curve (with repetitions)
thePoles2darray of poles of 2D curve
theWeightsarray of weights of corresponding poles

◆ calculateDerivative()

void BSplCLib_Cache::calculateDerivative ( double theParameter,
int theDerivative,
double * theDerivArray ) const
protected

Fills array of derivatives in the selected point of the curve.

Parameters
[in]theParameterparameter of the calculation
[in]theDerivativemaximal derivative to be calculated (computes all derivatives lesser than specified)
[out]theDerivArrayresult array of derivatives with size (theDerivative+1)*(PntDim+1), where PntDim = 2 or 3 is a dimension of the curve

◆ calculateDerivativeLocal()

void BSplCLib_Cache::calculateDerivativeLocal ( double theLocalParam,
int theDerivative,
double * theDerivArray ) const
protected

Fills array of derivatives using pre-computed local parameter.

Parameters
[in]theLocalParampre-computed local parameter: (Param - SpanStart) / SpanLength
[in]theDerivativemaximal derivative to be calculated (1, 2, or 3)
[out]theDerivArrayresult array of derivatives

◆ D0() [1/2]

void BSplCLib_Cache::D0 ( const double & theParameter,
gp_Pnt & thePoint ) const

◆ D0() [2/2]

void BSplCLib_Cache::D0 ( const double & theParameter,
gp_Pnt2d & thePoint ) const

Calculates the point on the curve in the specified parameter.

Parameters
[in]theParameterparameter of calculation of the value
[out]thePointthe result of calculation (the point on the curve)

◆ D0Local() [1/2]

void BSplCLib_Cache::D0Local ( double theLocalParam,
gp_Pnt & thePoint ) const

Calculates the 3D point using pre-computed local parameter in [0, 1] range. This bypasses periodic normalization and local parameter calculation.

Parameters
[in]theLocalParampre-computed local parameter: (Param - SpanStart) / SpanLength
[out]thePointthe result of calculation (the point on the curve)

◆ D0Local() [2/2]

void BSplCLib_Cache::D0Local ( double theLocalParam,
gp_Pnt2d & thePoint ) const

Calculates the 2D point using pre-computed local parameter in [0, 1] range. This bypasses periodic normalization and local parameter calculation.

Parameters
[in]theLocalParampre-computed local parameter: (Param - SpanStart) / SpanLength
[out]thePointthe result of calculation (the point on the curve)

◆ D1() [1/2]

void BSplCLib_Cache::D1 ( const double & theParameter,
gp_Pnt & thePoint,
gp_Vec & theTangent ) const

◆ D1() [2/2]

void BSplCLib_Cache::D1 ( const double & theParameter,
gp_Pnt2d & thePoint,
gp_Vec2d & theTangent ) const

Calculates the point on the curve and its first derivative in the specified parameter.

Parameters
[in]theParameterparameter of calculation of the value
[out]thePointthe result of calculation (the point on the curve)
[out]theTangenttangent vector (first derivatives) for the curve in the calculated point

◆ D1Local() [1/2]

void BSplCLib_Cache::D1Local ( double theLocalParam,
gp_Pnt & thePoint,
gp_Vec & theTangent ) const

Calculates the 3D point and first derivative using pre-computed local parameter.

Parameters
[in]theLocalParampre-computed local parameter: (Param - SpanStart) / SpanLength
[out]thePointthe point on the curve
[out]theTangentfirst derivative (tangent vector)

◆ D1Local() [2/2]

void BSplCLib_Cache::D1Local ( double theLocalParam,
gp_Pnt2d & thePoint,
gp_Vec2d & theTangent ) const

Calculates the 2D point and first derivative using pre-computed local parameter.

Parameters
[in]theLocalParampre-computed local parameter: (Param - SpanStart) / SpanLength
[out]thePointthe point on the curve
[out]theTangentfirst derivative (tangent vector)

◆ D2() [1/2]

void BSplCLib_Cache::D2 ( const double & theParameter,
gp_Pnt & thePoint,
gp_Vec & theTangent,
gp_Vec & theCurvature ) const

◆ D2() [2/2]

void BSplCLib_Cache::D2 ( const double & theParameter,
gp_Pnt2d & thePoint,
gp_Vec2d & theTangent,
gp_Vec2d & theCurvature ) const

Calculates the point on the curve and two derivatives in the specified parameter.

Parameters
[in]theParameterparameter of calculation of the value
[out]thePointthe result of calculation (the point on the curve)
[out]theTangenttangent vector (1st derivatives) for the curve in the calculated point
[out]theCurvaturecurvature vector (2nd derivatives) for the curve in the calculated point

◆ D2Local() [1/2]

void BSplCLib_Cache::D2Local ( double theLocalParam,
gp_Pnt & thePoint,
gp_Vec & theTangent,
gp_Vec & theCurvature ) const

Calculates the 3D point, first and second derivatives using pre-computed local parameter.

Parameters
[in]theLocalParampre-computed local parameter: (Param - SpanStart) / SpanLength
[out]thePointthe point on the curve
[out]theTangentfirst derivative (tangent vector)
[out]theCurvaturesecond derivative (curvature vector)

◆ D2Local() [2/2]

void BSplCLib_Cache::D2Local ( double theLocalParam,
gp_Pnt2d & thePoint,
gp_Vec2d & theTangent,
gp_Vec2d & theCurvature ) const

Calculates the 2D point, first and second derivatives using pre-computed local parameter.

Parameters
[in]theLocalParampre-computed local parameter: (Param - SpanStart) / SpanLength
[out]thePointthe point on the curve
[out]theTangentfirst derivative (tangent vector)
[out]theCurvaturesecond derivative (curvature vector)

◆ D3() [1/2]

void BSplCLib_Cache::D3 ( const double & theParameter,
gp_Pnt & thePoint,
gp_Vec & theTangent,
gp_Vec & theCurvature,
gp_Vec & theTorsion ) const

◆ D3() [2/2]

void BSplCLib_Cache::D3 ( const double & theParameter,
gp_Pnt2d & thePoint,
gp_Vec2d & theTangent,
gp_Vec2d & theCurvature,
gp_Vec2d & theTorsion ) const

Calculates the point on the curve and three derivatives in the specified parameter.

Parameters
[in]theParameterparameter of calculation of the value
[out]thePointthe result of calculation (the point on the curve)
[out]theTangenttangent vector (1st derivatives) for the curve in the calculated point
[out]theCurvaturecurvature vector (2nd derivatives) for the curve in the calculated point
[out]theTorsionsecond curvature vector (3rd derivatives) for the curve in the calculated point

◆ D3Local() [1/2]

void BSplCLib_Cache::D3Local ( double theLocalParam,
gp_Pnt & thePoint,
gp_Vec & theTangent,
gp_Vec & theCurvature,
gp_Vec & theTorsion ) const

Calculates the 3D point, first, second and third derivatives using pre-computed local parameter.

Parameters
[in]theLocalParampre-computed local parameter: (Param - SpanStart) / SpanLength
[out]thePointthe point on the curve
[out]theTangentfirst derivative (tangent vector)
[out]theCurvaturesecond derivative (curvature vector)
[out]theTorsionthird derivative (torsion vector)

◆ D3Local() [2/2]

void BSplCLib_Cache::D3Local ( double theLocalParam,
gp_Pnt2d & thePoint,
gp_Vec2d & theTangent,
gp_Vec2d & theCurvature,
gp_Vec2d & theTorsion ) const

Calculates the 2D point, first, second and third derivatives using pre-computed local parameter.

Parameters
[in]theLocalParampre-computed local parameter: (Param - SpanStart) / SpanLength
[out]thePointthe point on the curve
[out]theTangentfirst derivative (tangent vector)
[out]theCurvaturesecond derivative (curvature vector)
[out]theTorsionthird derivative (torsion vector)

◆ IsCacheValid()

bool BSplCLib_Cache::IsCacheValid ( double theParameter) const

Verifies validity of the cache using flat parameter of the point.

Parameters
theParameterparameter of the point placed in the span

◆ operator=()

void BSplCLib_Cache::operator= ( const BSplCLib_Cache & )
protecteddelete

The documentation for this class was generated from the following file: