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

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

#include <cadex/Geom/BSplineCurve2d.hxx>

Inheritance diagram for cadex::Geom::BSplineCurve2d:
cadex::Geom::Curve2d cadex::Geom::Geometry cadex::BaseObject

Public Member Functions

 BSplineCurve2d ()
 Constructor.
 
 BSplineCurve2d (const std::vector< Point2d > &thePoles, const std::vector< double > &theKnots, const std::vector< int > &theMultiplicities, int theDegree, bool theIsPeriodic=false)
 Constructor.
 
 BSplineCurve2d (const std::vector< Point2d > &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.
 
Point2d Pole (int theIndex) const
 Returns a pole value.
 
std::vector< Point2dPoles () 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::Curve2d
 Curve2d ()
 Constructor.
 
CurveType Type () const
 Returns a curve type.
 
Geom::Continuity Continuity () const
 Returns a continuity type of the curve.
 
Geom::Point2d Value (double theParameter) const
 Evaluates a point on the curve.
 
Geom::Direction2d Normal (double theParameter) const
 Returns the normal direction theNormal of parameter theParam.
 
double Curvature (double theParameter) const
 Returns the curvature value of parameter theParam.
 
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 D0 (double theParameter, Point2d &theValue) const
 Returns the point theValue of parameter theParam.
 
void D1 (double theParameter, Point2d &theValue, Vector2d &theD1) const
 Returns the point theValue of parameter theParam and the first derivative theD1.
 
void D2 (double theParameter, Point2d &theValue, Vector2d &theD1, Vector2d &theD2) const
 Returns the point theValue of parameter theParam and second derivatives theD1 and theD2.
 
bool DN (double theParameter, size_t theDerivativeOrder, Geom::Point2d &theValue, std::vector< Geom::Vector2d > &theD) const
 
void Transform (const Transformation2d &theTransformation)
 Applies transformation matrix to this object.
 
Curve2d Transformed (const Transformation2d &theTransformation) const
 Returns a copy this object after applying transformation.
 
- 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::Curve2d
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::Curve2d
 Curve2d (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 2D B-Spline curve.

For detailed description refer to 3D counterpart BSplineCurve.

Constructor & Destructor Documentation

◆ BSplineCurve2d() [1/2]

cadex::Geom::BSplineCurve2d::BSplineCurve2d ( const std::vector< Point2d > & 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 for Geom::BSplineCurve.

◆ BSplineCurve2d() [2/2]

cadex::Geom::BSplineCurve2d::BSplineCurve2d ( const std::vector< Point2d > & 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 for Geom::BSplineCurve.

Poles are to be provided after division by their weights.

Member Function Documentation

◆ Degree()

int cadex::Geom::BSplineCurve2d::Degree ( ) const

Returns degree.

Returns the value specified in the constructor.

◆ IsRational()

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

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

See also
Weight().

◆ Knot()

double cadex::Geom::BSplineCurve2d::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::BSplineCurve2d::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::BSplineCurve2d::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::BSplineCurve2d::Multiplicity ( int theIndex) const

Returns a knot multiplicity.

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

See also
Knot().

◆ NumberOfKnots()

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

Returns number of unique knots.

Returns the value specified in the constructor.

◆ NumberOfPoles()

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

Returns number of poles.

Returns the value specified in the constructor.

◆ Pole()

Point2d cadex::Geom::BSplineCurve2d::Pole ( int theIndex) const

Returns a pole value.

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

See also
Weight().

◆ Poles()

std::vector< Point2d > cadex::Geom::BSplineCurve2d::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::BSplineCurve2d::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().

◆ Weights()

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