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

Defines a B-Spline surface. More...

#include <cadex/ModelData_BSplineSurface.hxx>

Inheritance diagram for cadex::ModelData_BSplineSurface:
cadex::ModelData_Surface

Public Types

typedef cadex::internal::ModelData_BSplineSurfaceImpl ImplType
 

Public Member Functions

 ModelData_BSplineSurface ()
 Constructor.
 
 ModelData_BSplineSurface (const ModelData_Point thePoles[], int theNumberOfUPoles, int theNumberOfVPoles, const double theUKnots[], const double theVKnots[], int theNumberOfUKnots, int theNumberOfVKnots, const int theUMults[], const int theVMults[], int theUDegree, int theVDegree, bool theIsUPeriodic=false, bool theIsVPeriodic=false)
 Constructor.
 
 ModelData_BSplineSurface (const ModelData_Point thePoles[], const double thePoleWeights[], int theNumberOfUPoles, int theNumberOfVPoles, const double theUKnots[], const double theVKnots[], int theNumberOfUKnots, int theNumberOfVKnots, const int theUMults[], const int theVMults[], int theUDegree, int theVDegree, bool theIsUPeriodic=false, bool theIsVPeriodic=false)
 Constructor.
 
 ModelData_BSplineSurface (const Handle_C &)
 Constructor.
 
int UDegree () const
 Returns U-degree.
 
int VDegree () const
 Returns V-degree.
 
int NumberOfUKnots () const
 Returns number of unique U-knots.
 
int NumberOfUPoles () const
 Returns number of U-poles.
 
int NumberOfVKnots () const
 Returns number of unique V-knots.
 
int NumberOfVPoles () const
 Returns number of V-poles.
 
double UKnot (int theUIndex) const
 Returns a U-knot value.
 
int UKnots (double theUKnots[]) const
 Populates a vector of U-knots.
 
double VKnot (int theVIndex) const
 Returns a V-knot value.
 
int VKnots (double theVKnots[]) const
 Populates a vector of V-knots.
 
int UMultiplicity (int theUIndex) const
 Returns a U knot multiplicity.
 
int UMultiplicities (int theUMultiplicities[]) const
 Populates a vector of U knot multiplicities.
 
int VMultiplicity (int theVIndex) const
 Returns a V knot multiplicity.
 
int VMultiplicities (int theVMultiplicities[]) const
 Populates a vector of V knot multiplicities.
 
ModelData_Point Pole (int theUIndex, int theVIndex) const
 Returns a pole value.
 
int Poles (ModelData_Point thePoles[]) const
 Populates a 2D table of poles.
 
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.
 
double Weight (int theUIndex, int theVIndex) const
 Returns a weight value.
 
int Weights (double theWeights[]) const
 Populates a 2D table of weights.
 
- Public Member Functions inherited from cadex::ModelData_Surface
 ModelData_Surface ()
 Constructor.
 
 ModelData_Surface (const ModelData_Surface &theOther)
 Constructor.
 
 ModelData_Surface (ModelData_Surface &&theOther)
 Constructor.
 
 ~ModelData_Surface ()
 Destructor.
 
ModelData_Surfaceoperator= (const ModelData_Surface &theOther)
 Assignment operator.
 
ModelData_Surfaceoperator= (ModelData_Surface &&theOther)
 Move assignment operator.
 
ModelData_SurfaceType Type () const
 Returns a surface type.
 
bool IsNull () const
 Returns true if the object has not been initialized yet.
 
void Nullify ()
 Resets the object.
 
 operator bool () const
 
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.
 
ModelData_Point Value (double theParameterU, double theParameterV) const
 Evaluates a point on the surface.
 
void Transform (const ModelData_Transformation &theTransformation)
 Applies transformation matrix to this object.
 
ModelData_Surface Transformed (const ModelData_Transformation &theTransformation) const
 Returns a copy this object after applying transformation.
 
ModelData_Continuity Continuity () const
 Returns a continuity type of the surface.
 
void D0 (double theParameterU, double theParameterV, ModelData_Point &theValue) const
 Returns the point theValue of parameter theU, theV on the surface.
 
void D1 (double theParameterU, double theParameterV, ModelData_Point &theValue, ModelData_Vector &theD1U, ModelData_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, ModelData_Point &theValue, ModelData_Vector &theD1U, ModelData_Vector &theD1V, ModelData_Vector &theD2U, ModelData_Vector &theD2V, ModelData_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, ModelData_Point &theValue, ModelData_Vector theD[]) const
 
void Curvature (double theParameterU, double theParameterV, ModelData_Vector &thePrincipalMaxDirection, ModelData_Vector &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, ModelData_Direction &thePrincipalMaxDirection, ModelData_Direction &thePrincipalMinDirection, double &theMaxCurvature, double &theMinCurvature) const
 Returns the max and min principal curvature directions and their values.
 
void Normal (double theParameterU, double theParameterV, ModelData_Direction &theNormal) const
 Returns the normal direction theNormal at the current point.
 
void Mirror (const ModelData_Point &thePoint)
 Mirrors the surface relative to the point.
 
void Mirror (const ModelData_Axis1Placement &theAxis)
 Mirrors the surface relative to the axis placement.
 
void Mirror (const ModelData_Axis2Placement &theAxis)
 Mirrors the surface relative to the axis placement.
 
ModelData_Surface Mirrored (const ModelData_Point &theRef) const
 Returns a copy this surface mirrored along the object.
 
ModelData_Surface Mirrored (const ModelData_Axis1Placement &theAxis) const
 Returns a copy this surface mirrored along the object.
 
ModelData_Surface Mirrored (const ModelData_Axis2Placement &theAxis) const
 Returns a copy this surface mirrored along the object.
 
void Rotate (const ModelData_Axis1Placement &theAxis, double theAngle)
 Rotates the surface around the axis.
 
ModelData_Surface Rotated (const ModelData_Axis1Placement &theAxis, double theAngle) const
 Returns a copy this surface rotated along the axis.
 
void Translate (const ModelData_Vector &theVector)
 Translates the surface along the vector.
 
ModelData_Surface Translated (const ModelData_Vector &theVector) const
 Returns a copy this surface translated along the vector.
 
void Scale (const ModelData_Point &thePoint, double theScale)
 Scales the surface with respect to the point.
 
ModelData_Surface Scaled (const ModelData_Point &thePoint, double theScale) const
 Returns a copy this surface scaled with respect to the point.
 

Public Attributes

 operator Handle_C const
 

Detailed Description

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:

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:

  • 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_BSplineSurface() [1/3]

cadex::ModelData_BSplineSurface::ModelData_BSplineSurface ( )
inline

Constructor.

Empty constructor.

◆ ModelData_BSplineSurface() [2/3]

cadex::ModelData_BSplineSurface::ModelData_BSplineSurface ( const ModelData_Point  thePoles[],
int  theNumberOfUPoles,
int  theNumberOfVPoles,
const double  theUKnots[],
const double  theVKnots[],
int  theNumberOfUKnots,
int  theNumberOfVKnots,
const int  theUMults[],
const int  theVMults[],
int  theUDegree,
int  theVDegree,
bool  theIsUPeriodic = false,
bool  theIsVPeriodic = false 
)

Constructor.

Creates a polynomial B-Spline surface.

Parameters:

  • thePoles contains a 2D table of poles, with size equal to theNumberOfUPoles * theNumberOfVPoles; theNumberOfUPoles and theNumberOfVPoles must be >=2 each;
  • theNumberOfUKnots defines the length of theUKnots and theUMults and must be >=2;
  • theNumberOfVKnots defines the length of theVKnots and theVMults and must be >=2;
  • theUDegree and theVDegree must belong to range [1, 25];
  • theIsUPeriodic and theIsVPeriodic specify if the B-Spline is periodic in U and/or V direction respectively.

Number of poles in U and V direction must meet the requirements described above.

◆ ModelData_BSplineSurface() [3/3]

cadex::ModelData_BSplineSurface::ModelData_BSplineSurface ( const ModelData_Point  thePoles[],
const double  thePoleWeights[],
int  theNumberOfUPoles,
int  theNumberOfVPoles,
const double  theUKnots[],
const double  theVKnots[],
int  theNumberOfUKnots,
int  theNumberOfVKnots,
const int  theUMults[],
const int  theVMults[],
int  theUDegree,
int  theVDegree,
bool  theIsUPeriodic = false,
bool  theIsVPeriodic = false 
)

Constructor.

Creates a rational B-Spline surface.

Parameters:

  • thePoles contains a 2D table of poles, with size equal to theNumberOfUPoles * theNumberOfVPoles; theNumberOfUPoles and theNumberOfVPoles must be >=2 each;
  • thePoleWeights defines pole weights and must have the same size and layout as thePoles;
  • theNumberOfUKnots defines the length of theUKnots and theUMults and must be >=2;
  • theNumberOfVKnots defines the length of theVKnots and theVMults and must be >=2;
  • theUDegree and theVDegree must belong to range [1, 25];
  • theIsUPeriodic and theIsVPeriodic specify if the B-Spline is periodic in U and/or V direction respectively.

Number of poles in U and V direction must meet the requirements described above.

Poles are to be provided after division by their weights.

Member Function Documentation

◆ IsURational()

bool cadex::ModelData_BSplineSurface::IsURational ( ) const

Returns true if the B-Spline curve is rational in U direction.

See also
Weights(), IsVRational().

◆ IsVRational()

bool cadex::ModelData_BSplineSurface::IsVRational ( ) const

Returns true if the B-Spline curve is rational in V direction.

See also
Weights(), IsURational().

◆ NumberOfUKnots()

int cadex::ModelData_BSplineSurface::NumberOfUKnots ( ) const

Returns number of unique U-knots.

Returns the value specified in the constructor.

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

◆ NumberOfUPoles()

int cadex::ModelData_BSplineSurface::NumberOfUPoles ( ) const

Returns number of U-poles.

Returns the value specified in the constructor.

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

◆ NumberOfVKnots()

int cadex::ModelData_BSplineSurface::NumberOfVKnots ( ) const

Returns number of unique V-knots.

Returns the value specified in the constructor.

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

◆ NumberOfVPoles()

int cadex::ModelData_BSplineSurface::NumberOfVPoles ( ) const

Returns number of V-poles.

Returns the value specified in the constructor.

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

◆ Pole()

ModelData_Point cadex::ModelData_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()].

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

◆ Poles()

int cadex::ModelData_BSplineSurface::Poles ( ModelData_Point  thePoles[]) 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().

See also
Weights().

◆ UDegree()

int cadex::ModelData_BSplineSurface::UDegree ( ) const

Returns U-degree.

Returns the value specified in the constructor.

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

◆ UKnot()

double cadex::ModelData_BSplineSurface::UKnot ( int  theUIndex) const

Returns a U-knot value.

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

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

◆ UKnots()

int cadex::ModelData_BSplineSurface::UKnots ( double  theUKnots[]) const

Populates a vector of U-knots.

theUKnots must point to a buffer in memory with at least NumberOfUKnots() preallocated values.

Returns NumberOfUKnots().

See also
UMultiplicities().

◆ UMultiplicities()

int cadex::ModelData_BSplineSurface::UMultiplicities ( int  theUMults[]) const

Populates a vector of U knot multiplicities.

theUMults must point to a buffer in memory with at least NumberOfUKnots() preallocated values.

Returns NumberOfUKnots().

See also
UKnots().

◆ UMultiplicity()

int cadex::ModelData_BSplineSurface::UMultiplicity ( int  theUIndex) const

Returns a U knot multiplicity.

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

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

◆ VDegree()

int cadex::ModelData_BSplineSurface::VDegree ( ) const

Returns V-degree.

Returns the value specified in the constructor.

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

◆ VKnot()

double cadex::ModelData_BSplineSurface::VKnot ( int  theVIndex) const

Returns a V-knot value.

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

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

◆ VKnots()

int cadex::ModelData_BSplineSurface::VKnots ( double  theVKnots[]) const

Populates a vector of V-knots.

theVKnots must point to a buffer in memory with at least NumberOfVKnots() preallocated values.

Returns NumberOfVKnots().

See also
VMultiplicities().

◆ VMultiplicities()

int cadex::ModelData_BSplineSurface::VMultiplicities ( int  theVMults[]) const

Populates a vector of V knot multiplicities.

theVMults must point to a buffer in memory with at least NumberOfVKnots() preallocated values.

Returns NumberOfVKnots().

See also
VKnots().

◆ VMultiplicity()

int cadex::ModelData_BSplineSurface::VMultiplicity ( int  theVIndex) const

Returns a V knot multiplicity.

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

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

◆ Weight()

double cadex::ModelData_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.

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

◆ Weights()

int cadex::ModelData_BSplineSurface::Weights ( double  theWeights[]) 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.

See also
Poles(), IsURational(), IsVRational().