Hide menu
Loading...
Searching...
No Matches
cadex::ModelData_BSplineCurve Class Reference

Defines 3D B-Spline curve. More...

#include <cadex/ModelData_BSplineCurve.hxx>

Inheritance diagram for cadex::ModelData_BSplineCurve:
cadex::ModelData_Curve

Public Types

typedef cadex::internal::ModelData_BSplineCurveImpl ImplType
 

Public Member Functions

 ModelData_BSplineCurve ()
 Constructor.
 
 ModelData_BSplineCurve (const ModelData_Point thePoles[], int theNumberOfPoles, const double theKnots[], int theNumberOfKnots, const int theMultiplicities[], int theDegree, bool theIsPeriodic=false)
 Constructor.
 
 ModelData_BSplineCurve (const ModelData_Point thePoles[], const double thePoleWeights[], int theNumberOfPoles, const double theKnots[], int theNumberOfKnots, const int theMultiplicities[], int theDegree, bool theIsPeriodic=false)
 Constructor.
 
 ModelData_BSplineCurve (const Handle_C &)
 Constructor.
 
int Degree () const
 Returns degree.
 
int NumberOfKnots () const
 Returns number of unique knots.
 
int NumberOfPoles () const
 Returns number of poles.
 
double Knot (int theIndex) const
 Returns a knot value.
 
int Knots (double theKnots[]) const
 Populates a vector of knots.
 
int Multiplicity (int theIndex) const
 Returns a knot multiplicity.
 
int Multiplicities (int theMultiplicities[]) const
 Populates a vector of knot multiplicities.
 
ModelData_Point Pole (int theIndex) const
 Returns a pole value.
 
int Poles (ModelData_Point thePoles[]) const
 Populates a vector of poles.
 
bool IsRational () const
 Returns true if the B-Spline curve is rational (i.e. has weights).
 
double Weight (int theIndex) const
 Returns a weight value.
 
int Weights (double theWeights[]) const
 Populates a vector of weights.
 
- Public Member Functions inherited from cadex::ModelData_Curve
 ModelData_Curve ()
 Constructor.
 
 ModelData_Curve (const ModelData_Curve &theOther)
 Constructor.
 
 ModelData_Curve (ModelData_Curve &&theOther)
 Constructor.
 
 ~ModelData_Curve ()
 Destructor.
 
ModelData_Curveoperator= (const ModelData_Curve &theOther)
 Assignment operator.
 
ModelData_Curveoperator= (ModelData_Curve &&theOther)
 Move assignment operator.
 
ModelData_CurveType Type () const
 Returns a curve type.
 
bool IsNull () const
 Returns true if the object has not been initialized yet.
 
void Nullify ()
 Resets the object.
 
 operator bool () const
 Returns if the object has been initialized.
 
bool IsPeriodic () const
 Returns true if the curve is periodic.
 
double UMin () const
 Returns a minimum parameter of a definition domain.
 
double UMax () const
 Returns a maximum parameter of a definition domain.
 
void Domain (double &theUMin, double &theUMax) const
 Returns a definition domain.
 
ModelData_Point Value (double theParameter) const
 Evaluates a point on the curve.
 
ModelData_Curve Reversed () const
 Returns a curve with reversed orientation.
 
void Transform (const ModelData_Transformation &theTransformation)
 Applies transformation matrix to this object.
 
ModelData_Curve Transformed (const ModelData_Transformation &theTransformation) const
 Returns a copy this object after applying transformation.
 
ModelData_Continuity Continuity () const
 Returns a continuity type of the curve.
 
void D0 (double theParameter, ModelData_Point &theValue) const
 Returns the point theValue of parameter theParam.
 
void D1 (double theParameter, ModelData_Point &theValue, ModelData_Vector &theD1) const
 Returns the point theValue of parameter theParam and the first derivative theD1.
 
void D2 (double theParameter, ModelData_Point &theValue, ModelData_Vector &theD1, ModelData_Vector &theD2) const
 Returns the point theValue of parameter theParam, the first theD1 and second theD2 derivatives.
 
bool DN (double theParameter, size_t theDerivativeOrder, ModelData_Point &theValue, ModelData_Vector theD[]) const
 
double Curvature (double theParameter) const
 Returns the curvature value of parameter theParam.
 
void Normal (double theParameter, ModelData_Direction &theNormal) const
 Returns the normal direction theNormal of parameter theParam.
 
void Mirror (const ModelData_Point &thePoint)
 Mirrors the curve relative to the point.
 
void Mirror (const ModelData_Axis1Placement &theAxis)
 Mirrors the curve relative to the axis placement.
 
void Mirror (const ModelData_Axis2Placement &theAxis)
 Mirrors the curve relative to the axis placement.
 
ModelData_Curve Mirrored (const ModelData_Point &theRef) const
 Returns a copy this curve mirrored along the object.
 
ModelData_Curve Mirrored (const ModelData_Axis1Placement &theAxis) const
 Returns a copy this curve mirrored along the object.
 
ModelData_Curve Mirrored (const ModelData_Axis2Placement &theAxis) const
 Returns a copy this curve mirrored along the object.
 
void Rotate (const ModelData_Axis1Placement &theAxis, double theAngle)
 Rotates the curve around the axis.
 
ModelData_Curve Rotated (const ModelData_Axis1Placement &theAxis, double theAngle) const
 Returns a copy this curve rotated along the axis.
 
void Translate (const ModelData_Vector &theVector)
 Translates the curve along the vector.
 
ModelData_Curve Translated (const ModelData_Vector &theVector) const
 Returns a copy this curve translated along the vector.
 
void Scale (const ModelData_Point &thePoint, double theScale)
 Scales the curve with respect to the point.
 
ModelData_Curve Scaled (const ModelData_Point &thePoint, double theScale) const
 Returns a copy this curve scaled with respect to the point.
 

Public Attributes

 operator Handle_C const
 
- Public Attributes inherited from cadex::ModelData_Curve
 operator Handle_C const
 

Detailed Description

Defines 3D B-Spline curve.

B-Spline curve is defined by degree, control points (poles), their weights, unique knots and their multiplicities. The following image depicts an example of a B-Spline curve:

B-Spline curve

For introduction to and mathematical definition of NURBS please refer to external resources, for instance:

A rational B-Spline contains an explicit vector of weights, whereas polynomial does not.

The number of poles must equal the number of weights. The number of poles is defined via the following formulas:

  • for non-periodic B-Spline: number_of_poles = sum_of_knot_multiplicities - degree - 1;
  • for periodic B-Spline: number_of_poles = sum_of_knot_multiplicities - start_multiplicity.

B-Splines of degree up to 25 are supported.

Examples
exploring/brepgeometry/Program.cs, exploring/brepgeometry/main.cxx, modeling/brep/Program.cs, and modeling/brep/main.cxx.

Constructor & Destructor Documentation

◆ ModelData_BSplineCurve() [1/3]

cadex::ModelData_BSplineCurve::ModelData_BSplineCurve ( )
inline

Constructor.

Empty constructor.

◆ ModelData_BSplineCurve() [2/3]

cadex::ModelData_BSplineCurve::ModelData_BSplineCurve ( const ModelData_Point  thePoles[],
int  theNumberOfPoles,
const double  theKnots[],
int  theNumberOfKnots,
const int  theMultiplicities[],
int  theDegree,
bool  theIsPeriodic = false 
)

Constructor.

Creates a polynomial B-Spline curve.

Parameters:

  • theNumberOfPoles defines the length of thePoles and must be >=2;
  • theNumberOfKnots defines the length of theKnots and theMultiplicities and must be >=2;
  • theDegree must belong to range [1, 25];
  • theIsPeriodic specifies if the B-Spline is periodic.

theNumberOfPoles must meet the requirements described above.

◆ ModelData_BSplineCurve() [3/3]

cadex::ModelData_BSplineCurve::ModelData_BSplineCurve ( const ModelData_Point  thePoles[],
const double  thePoleWeights[],
int  theNumberOfPoles,
const double  theKnots[],
int  theNumberOfKnots,
const int  theMultiplicities[],
int  theDegree,
bool  theIsPeriodic = false 
)

Constructor.

Creates a rational B-Spline curve.

Parameters:

  • theNumberOfPoles defines the length of thePoles and thePoleWeights and must be >=2;
  • theNumberOfKnots defines the length of theKnots and theMultiplicities and must be >=2;
  • theDegree must belong to range [1, 25];
  • theIsPeriodic specifies if the B-Spline is periodic.

theNumberOfPoles must meet the requirements described above.

Poles are to be provided after division by their weights.

Member Function Documentation

◆ Degree()

int cadex::ModelData_BSplineCurve::Degree ( ) const

Returns degree.

Returns the value specified in the constructor.

Examples
exploring/brepgeometry/Program.cs, and exploring/brepgeometry/main.cxx.

◆ IsRational()

bool cadex::ModelData_BSplineCurve::IsRational ( ) const

Returns true if the B-Spline curve is rational (i.e. has weights).

See also
Weight().

◆ Knot()

double cadex::ModelData_BSplineCurve::Knot ( int  theIndex) const

Returns a knot value.

theIndex must be in the range [1, NumberOfKnots()].

See also
Multiplicity().
Examples
exploring/brepgeometry/Program.cs, and exploring/brepgeometry/main.cxx.

◆ Knots()

int cadex::ModelData_BSplineCurve::Knots ( double  theKnots[]) const

Populates a vector of knots.

theKnots must point to a buffer in memory with at least NumberOfKnots() preallocated values.

Returns NumberOfKnots().

See also
Multiplicities().

◆ Multiplicities()

int cadex::ModelData_BSplineCurve::Multiplicities ( int  theMultiplicities[]) const

Populates a vector of knot multiplicities.

theMultiplicities must point to a buffer in memory with at least NumberOfKnots() preallocated values.

Returns NumberOfKnots().

See also
Knots().

◆ Multiplicity()

int cadex::ModelData_BSplineCurve::Multiplicity ( int  theIndex) const

Returns a knot multiplicity.

theIndex must be in the range [1, NumberOfKnots()].

See also
Knot().
Examples
exploring/brepgeometry/Program.cs, and exploring/brepgeometry/main.cxx.

◆ NumberOfKnots()

int cadex::ModelData_BSplineCurve::NumberOfKnots ( ) const

Returns number of unique knots.

Returns the value specified in the constructor.

Examples
exploring/brepgeometry/Program.cs, and exploring/brepgeometry/main.cxx.

◆ NumberOfPoles()

int cadex::ModelData_BSplineCurve::NumberOfPoles ( ) const

Returns number of poles.

Returns the value specified in the constructor.

Examples
exploring/brepgeometry/Program.cs, and exploring/brepgeometry/main.cxx.

◆ Pole()

ModelData_Point cadex::ModelData_BSplineCurve::Pole ( int  theIndex) const

Returns a pole value.

theIndex must be in the range [1, NumberOfPoles()].

See also
Weight().
Examples
exploring/brepgeometry/Program.cs, and exploring/brepgeometry/main.cxx.

◆ Poles()

int cadex::ModelData_BSplineCurve::Poles ( ModelData_Point  thePoles[]) const

Populates a vector of poles.

thePoles must point to a buffer in memory with at least NumberOfPoles() preallocated values.

Returns NumberOfPoles().

See also
Weights().

◆ Weight()

double cadex::ModelData_BSplineCurve::Weight ( int  theIndex) const

Returns a weight value.

theIndex must be in the range [1, NumberOfPoles()].

For polynomial B-Spline behavior is undefined.

See also
Pole(), IsRational().
Examples
exploring/brepgeometry/Program.cs, and exploring/brepgeometry/main.cxx.

◆ Weights()

int cadex::ModelData_BSplineCurve::Weights ( double  theWeights[]) const

Populates a vector of weights.

theWeights must point to a buffer in memory with at least NumberOfPoles() preallocated values.

Returns NumberOfPoles().

For polynomial B-Spline does nothing and returns 0.

See also
Poles(), IsRational().