Defines a B-Spline surface. More...
#include <cadex/Geom/BSplineSurface.hxx>
Public Member Functions | |
BSplineSurface () | |
Constructor. | |
BSplineSurface (const std::vector< Point > &thePoles, int theNumberOfUPoles, int theNumberOfVPoles, const std::vector< double > &theUKnots, const std::vector< double > &theVKnots, const std::vector< int > &theUMults, const std::vector< int > &theVMults, int theUDegree, int theVDegree, bool theIsUPeriodic=false, bool theIsVPeriodic=false) | |
Constructor. | |
BSplineSurface (const std::vector< Point > &thePoles, const std::vector< double > &theWeights, int theNumberOfUPoles, int theNumberOfVPoles, const std::vector< double > &theUKnots, const std::vector< double > &theVKnots, const std::vector< int > &theUMults, const std::vector< int > &theVMults, int theUDegree, int theVDegree, bool theIsUPeriodic=false, bool theIsVPeriodic=false) | |
Constructor. | |
int | UDegree () const |
Returns U-degree. | |
int | VDegree () const |
Returns V-degree. | |
int | NumberOfUPoles () const |
Returns number of U-poles. | |
int | NumberOfVPoles () const |
Returns number of V-poles. | |
int | NumberOfUKnots () const |
Returns number of unique U-knots. | |
int | NumberOfVKnots () const |
Returns number of unique V-knots. | |
Point | Pole (int theUIndex, int theVIndex) const |
Returns a pole value. | |
std::vector< Point > | Poles () const |
Populates a 2D table of poles. | |
double | Weight (int theUIndex, int theVIndex) const |
Returns a weight value. | |
std::vector< double > | Weights () const |
Populates a 2D table of weights. | |
double | UKnot (int theUIndex) const |
Returns a U-knot value. | |
double | VKnot (int theVIndex) const |
Returns a V-knot value. | |
std::vector< double > | UKnots () const |
Populates a vector of U-knots. | |
std::vector< double > | VKnots () const |
Populates a vector of V-knots. | |
int | UMultiplicity (int theUIndex) const |
Returns a U knot multiplicity. | |
int | VMultiplicity (int theVIndex) const |
Returns a V knot multiplicity. | |
std::vector< int > | UMultiplicities () const |
Populates a vector of U knot multiplicities. | |
std::vector< int > | VMultiplicities () const |
Populates a vector of V knot multiplicities. | |
bool | IsURational () const |
Returns true if the B-Spline curve is rational in U direction. | |
bool | IsVRational () const |
Returns true if the B-Spline curve is rational in V direction. | |
![]() | |
Surface () | |
Constructor. | |
SurfaceType | Type () const |
Returns a surface type. | |
Geom::Continuity | Continuity () const |
Returns a continuity type of the surface. | |
Point | Value (double theParameterU, double theParameterV) const |
Evaluates a point on the surface. | |
Direction | Normal (double theParameterU, double theParameterV) const |
Returns the normal direction theNormal at the current point. | |
bool | IsUPeriodic () const |
Returns true if the surface is periodic in U direction. | |
bool | IsVPeriodic () const |
Returns true if the surface is periodic in V direction. | |
double | UMin () const |
Returns a minimum parameter of a definition domain in U direction. | |
double | UMax () const |
Returns a maximum parameter of a definition domain in U direction. | |
double | VMin () const |
Returns a minimum parameter of a definition domain in V direction. | |
double | VMax () const |
Returns a maximum parameter of a definition domain in V direction. | |
void | Domain (double &theUMin, double &theUMax, double &theVMin, double &theVMax) const |
Returns a definition domain. | |
bool | IsTrimmed () const |
Returns whether surface is trimmed or not. | |
void | SetTrim (double theUFirst, double theULast, double theVFirst, double theVLast) |
Trims surface with [theUFirst, theULast] x [theVFirst, theVLast] section. | |
void | Transform (const Transformation &theTransformation) |
Applies transformation matrix to this object. | |
Surface | Transformed (const Transformation &theTransformation) const |
Returns a copy this object after applying transformation. | |
void | D0 (double theParameterU, double theParameterV, Point &theValue) const |
Returns the point theValue of parameter theU, theV on the surface. | |
void | D1 (double theParameterU, double theParameterV, Point &theValue, Vector &theD1U, Vector &theD1V) const |
Returns the point theValue and the first derivatives in the directions U theD1U and V theD1V at this point. | |
void | D2 (double theParameterU, double theParameterV, Point &theValue, Vector &theD1U, Vector &theD1V, Vector &theD2U, Vector &theD2V, Vector &theD2UV) const |
Returns the point theValue, the first and the second derivatives in the directions U and V at this point. | |
bool | DN (double theParameterU, double theParameterV, size_t theDerivativeOrder, Geom::Point &theValue, std::vector< Geom::Vector > &theD) const |
void | Curvature (double theParameterU, double theParameterV, Direction &thePrincipalMaxDirection, Direction &thePrincipalMinDirection) const |
Returns the max and min principal curvature directions multiplied by max and min value of curvature respectively. | |
void | Curvature (double theParameterU, double theParameterV, Direction &thePrincipalMaxDirection, Direction &thePrincipalMinDirection, double &theMaxCurvature, double &theMinCurvature) const |
Returns the max and min principal curvature directions and their values. | |
void | Mirror (const Point &thePoint) |
void | Mirror (const Axis1d &theAxis) |
void | Mirror (const Axis3d &theAxis) |
Surface | Mirrored (const Point &theRef) const |
Surface | Mirrored (const Axis1d &theAxis) const |
Surface | Mirrored (const Axis3d &theAxis) const |
void | Rotate (const Axis1d &theAxis, double theAngle) |
Surface | Rotated (const Axis1d &theAxis, double theAngle) const |
void | Translate (const Vector &theVector) |
Surface | Translated (const Vector &theVector) const |
void | Scale (const Point &thePoint, double theScale) |
Surface | Scaled (const Point &thePoint, double theScale) const |
![]() | |
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 bool | CompareType (const BaseObject &theObject) |
![]() | |
static bool | CompareType (const BaseObject &theObject) |
Additional Inherited Members | |
![]() | |
typedef std::shared_ptr< internal::BaseObjectImpl > | ImplType |
![]() | |
Surface (const ImplType &theImpl) | |
![]() | |
Geometry (const ImplType &theImpl) | |
![]() | |
BaseObject (const ImplType &theImpl) | |
Defines a B-Spline surface.
B-Spline surface is defined by degree, control points (poles), their weights, unique knots and their multiplicities. The following image depicts an example of a B-Spline surface:
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 in each direction (U or V) is defined via the following formulas:
B-Splines of degree up to 25 are supported.
cadex::Geom::BSplineSurface::BSplineSurface | ( | const std::vector< Point > & | thePoles, |
int | theNumberOfUPoles, | ||
int | theNumberOfVPoles, | ||
const std::vector< double > & | theUKnots, | ||
const std::vector< double > & | theVKnots, | ||
const std::vector< int > & | theUMults, | ||
const std::vector< int > & | theVMults, | ||
int | theUDegree, | ||
int | theVDegree, | ||
bool | theIsUPeriodic = false, | ||
bool | theIsVPeriodic = false ) |
Constructor.
Creates a polynomial B-Spline surface.
Parameters:
Number of poles in U and V direction must meet the requirements described above.
cadex::Geom::BSplineSurface::BSplineSurface | ( | const std::vector< Point > & | thePoles, |
const std::vector< double > & | theWeights, | ||
int | theNumberOfUPoles, | ||
int | theNumberOfVPoles, | ||
const std::vector< double > & | theUKnots, | ||
const std::vector< double > & | theVKnots, | ||
const std::vector< int > & | theUMults, | ||
const std::vector< int > & | theVMults, | ||
int | theUDegree, | ||
int | theVDegree, | ||
bool | theIsUPeriodic = false, | ||
bool | theIsVPeriodic = false ) |
Constructor.
Creates a rational B-Spline surface.
Parameters:
Number of poles in U and V direction must meet the requirements described above.
Poles are to be provided after division by their weights.
bool cadex::Geom::BSplineSurface::IsURational | ( | ) | const |
Returns true if the B-Spline curve is rational in U direction.
bool cadex::Geom::BSplineSurface::IsVRational | ( | ) | const |
Returns true if the B-Spline curve is rational in V direction.
int cadex::Geom::BSplineSurface::NumberOfUKnots | ( | ) | const |
Returns number of unique U-knots.
Returns the value specified in the constructor.
int cadex::Geom::BSplineSurface::NumberOfUPoles | ( | ) | const |
Returns number of U-poles.
Returns the value specified in the constructor.
int cadex::Geom::BSplineSurface::NumberOfVKnots | ( | ) | const |
Returns number of unique V-knots.
Returns the value specified in the constructor.
int cadex::Geom::BSplineSurface::NumberOfVPoles | ( | ) | const |
Returns number of V-poles.
Returns the value specified in the constructor.
Point cadex::Geom::BSplineSurface::Pole | ( | int | theUIndex, |
int | theVIndex ) const |
Returns a pole value.
theUIndex must be in the range [1, NumberOfUPoles()], theVIndex in the range [1, NumberOfVPoles()].
std::vector< Point > cadex::Geom::BSplineSurface::Poles | ( | ) | const |
Populates a 2D table of poles.
thePoles must point to a buffer in memory with at least NumberOfUPoles() * NumberOfVPoles() preallocated values.
Returns NumberOfUPoles() * NumberOfVPoles().
int cadex::Geom::BSplineSurface::UDegree | ( | ) | const |
Returns U-degree.
Returns the value specified in the constructor.
double cadex::Geom::BSplineSurface::UKnot | ( | int | theUIndex | ) | const |
Returns a U-knot value.
theIndex must be in the range [1, NumberOfUKnots()].
std::vector< double > cadex::Geom::BSplineSurface::UKnots | ( | ) | const |
Populates a vector of U-knots.
theUKnots must point to a buffer in memory with at least NumberOfUKnots() preallocated values.
Returns NumberOfUKnots().
std::vector< int > cadex::Geom::BSplineSurface::UMultiplicities | ( | ) | const |
Populates a vector of U knot multiplicities.
theUMults must point to a buffer in memory with at least NumberOfUKnots() preallocated values.
Returns NumberOfUKnots().
int cadex::Geom::BSplineSurface::UMultiplicity | ( | int | theUIndex | ) | const |
Returns a U knot multiplicity.
theIndex must be in the range [1, NumberOfUKnots()].
int cadex::Geom::BSplineSurface::VDegree | ( | ) | const |
Returns V-degree.
Returns the value specified in the constructor.
double cadex::Geom::BSplineSurface::VKnot | ( | int | theVIndex | ) | const |
Returns a V-knot value.
theIndex must be in the range [1, NumberOfVKnots()].
std::vector< double > cadex::Geom::BSplineSurface::VKnots | ( | ) | const |
Populates a vector of V-knots.
theVKnots must point to a buffer in memory with at least NumberOfVKnots() preallocated values.
Returns NumberOfVKnots().
std::vector< int > cadex::Geom::BSplineSurface::VMultiplicities | ( | ) | const |
Populates a vector of V knot multiplicities.
theVMults must point to a buffer in memory with at least NumberOfVKnots() preallocated values.
Returns NumberOfVKnots().
int cadex::Geom::BSplineSurface::VMultiplicity | ( | int | theVIndex | ) | const |
Returns a V knot multiplicity.
theIndex must be in the range [1, NumberOfVKnots()].
double cadex::Geom::BSplineSurface::Weight | ( | int | theUIndex, |
int | theVIndex ) const |
Returns a weight value.
theUIndex must be in the range [1, NumberOfUPoles()], theVIndex in the range [1, NumberOfVPoles()].
For polynomial B-Spline behavior is undefined.
std::vector< double > cadex::Geom::BSplineSurface::Weights | ( | ) | const |
Populates a 2D table of weights.
theWeights must point to a buffer in memory with at least NumberOfUPoles() * NumberOfVPoles() preallocated values.
Returns NumberOfUPoles() * NumberOfVPoles().
For polynomial B-Spline does nothing and returns 0.