Hide menu
Loading...
Searching...
No Matches
cadex::Geom::BSplineCurve Class Reference

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

#include <cadex/Geom/BSplineCurve.hxx>

Inheritance diagram for cadex::Geom::BSplineCurve:
cadex::Geom::Curve cadex::Geom::Geometry cadex::BaseObject

Public Member Functions

 BSplineCurve ()
 Constructor.
 
 BSplineCurve (const std::vector< Point > &thePoles, const std::vector< double > &theKnots, const std::vector< int > &theMultiplicities, int theDegree, bool theIsPeriodic=false)
 Constructor.
 
 BSplineCurve (const std::vector< Point > &thePoles, const std::vector< double > &thePoleWeights, const std::vector< double > &theKnots, const std::vector< int > &theMultiplicities, int theDegree, bool theIsPeriodic=false)
 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.
 
std::vector< double > Knots () const
 Populates a vector of knots.
 
int Multiplicity (int theIndex) const
 Returns a knot multiplicity.
 
std::vector< int > Multiplicities () const
 Populates a vector of knot multiplicities.
 
Point Pole (int theIndex) const
 Returns a pole value.
 
std::vector< PointPoles () const
 Populates a vector of poles.
 
double Weight (int theIndex) const
 Returns a weight value.
 
std::vector< double > Weights () const
 Populates a vector of weights.
 
bool IsRational () const
 Returns true if the B-Spline curve is rational (i.e. has weights).
 
- Public Member Functions inherited from cadex::Geom::Curve
 Curve ()
 Constructor.
 
CurveType Type () const
 
Geom::Continuity Continuity () const
 Returns a continuity type of the curve.
 
Point Value (double theParameter) const
 Evaluates a point on the curve.
 
Direction Normal (double theParameter) const
 Returns the normal direction theNormal of parameter theParam.
 
double Curvature (double theParameter) const
 Returns the curvature value of parameter theParam.
 
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.
 
bool IsTrimmed () const
 Returns whether curve is trimmed or not.
 
void SetTrim (double theFirst, double theLast)
 Trims curve with [theFirst, theLast] section.
 
void Transform (const Transformation &theTransformation)
 Applies transformation matrix to this object.
 
Curve Transformed (const Transformation &theTransformation) const
 Returns a copy this object after applying transformation.
 
void D0 (double theParameter, Point &theValue) const
 Returns the point theValue of parameter theParam.
 
void D1 (double theParameter, Point &theValue, Vector &theD1) const
 Returns the point theValue of parameter theParam and the first derivative theD1.
 
void D2 (double theParameter, Point &theValue, Vector &theD1, Vector &theD2) const
 Returns the point theValue of parameter theParam, the first theD1 and second theD2 derivatives.
 
bool DN (double theParameter, size_t theDerivativeOrder, Geom::Point &theValue, std::vector< Geom::Vector > &theD) const
 
void Mirror (const Point &thePoint)
 
void Mirror (const Axis1d &theAxis)
 
void Mirror (const Axis3d &theAxis)
 
Curve Mirrored (const Point &theRef) const
 
Curve Mirrored (const Axis1d &theAxis) const
 
Curve Mirrored (const Axis3d &theAxis) const
 
void Rotate (const Axis1d &theAxis, double theAngle)
 
Curve Rotated (const Axis1d &theAxis, double theAngle) const
 
void Translate (const Vector &theVector)
 
Curve Translated (const Vector &theVector) const
 
void Scale (const Point &thePoint, double theScale)
 
Curve Scaled (const Point &thePoint, double theScale) const
 
- Public Member Functions inherited from cadex::BaseObject
size_t Id () const
 Return unique identifier of public object.
 
internal::BaseObjectImpl * Impl () const
 
bool IsNull () const
 
 operator bool () const
 
template<typename T >
bool IsOfType () const
 
template<typename T >
T * Impl () const
 Reserved for internal use.
 

Static Public Member Functions

static bool CompareType (const BaseObject &theObject)
 
- Static Public Member Functions inherited from cadex::Geom::Curve
static bool CompareType (const BaseObject &theObject)
 
- Static Public Member Functions inherited from cadex::Geom::Geometry
static bool CompareType (const BaseObject &theObject)
 

Additional Inherited Members

- Public Types inherited from cadex::BaseObject
typedef std::shared_ptr< internal::BaseObjectImpl > ImplType
 
- Protected Member Functions inherited from cadex::Geom::Curve
 Curve (const ImplType &theImpl)
 
- Protected Member Functions inherited from cadex::Geom::Geometry
 Geometry (const ImplType &theImpl)
 
- Protected Member Functions inherited from cadex::BaseObject
 BaseObject (const ImplType &theImpl)
 

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.

Constructor & Destructor Documentation

◆ BSplineCurve() [1/2]

cadex::Geom::BSplineCurve::BSplineCurve ( const std::vector< Point > & thePoles,
const std::vector< double > & theKnots,
const std::vector< 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.

◆ BSplineCurve() [2/2]

cadex::Geom::BSplineCurve::BSplineCurve ( const std::vector< Point > & thePoles,
const std::vector< double > & thePoleWeights,
const std::vector< double > & theKnots,
const std::vector< 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::Geom::BSplineCurve::Degree ( ) const

Returns degree.

Returns the value specified in the constructor.

◆ IsRational()

bool cadex::Geom::BSplineCurve::IsRational ( ) const

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

See also
Weight().

◆ Knot()

double cadex::Geom::BSplineCurve::Knot ( int theIndex) const

Returns a knot value.

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

See also
Multiplicity().

◆ Knots()

std::vector< double > cadex::Geom::BSplineCurve::Knots ( ) 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()

std::vector< int > cadex::Geom::BSplineCurve::Multiplicities ( ) 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::Geom::BSplineCurve::Multiplicity ( int theIndex) const

Returns a knot multiplicity.

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

See also
Knot().

◆ NumberOfKnots()

int cadex::Geom::BSplineCurve::NumberOfKnots ( ) const

Returns number of unique knots.

Returns the value specified in the constructor.

◆ NumberOfPoles()

int cadex::Geom::BSplineCurve::NumberOfPoles ( ) const

Returns number of poles.

Returns the value specified in the constructor.

◆ Pole()

Point cadex::Geom::BSplineCurve::Pole ( int theIndex) const

Returns a pole value.

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

See also
Weight().

◆ Poles()

std::vector< Point > cadex::Geom::BSplineCurve::Poles ( ) 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::Geom::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().

◆ Weights()

std::vector< double > cadex::Geom::BSplineCurve::Weights ( ) 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().