Jameo Core Library
Loading...
Searching...
No Matches
Public Member Functions | List of all members
jm::Nurbs Class Reference

NURBS (nonuniform rational basis splines) are a generalized form of B-Splines. They allow for modeling many curves, including projected forms. DXF splines, for example, are based on NURBS. This class provides functions and methods to work with NURBS. More...

Inheritance diagram for jm::Nurbs:
jm::Object

Public Member Functions

 Nurbs ()
 Default constructor for the Nurbs class.
 
 Nurbs (uint32 degree, const Vertex3 *controlpoints, size_t controlCount, const double *knots, size_t knotCount, const double *weights, size_t weightCount)
 Constructor for the Nurbs class.
 
 ~Nurbs () override
 Destructor.
 
Vertex3 point (double t)
 Returns a point on the curve at a given parameter value.
 
double start () const
 This method returns the smallest value of t.
 
double end () const
 This method returns the maximum value of t.
 
size_t startIndex () const
 The start index for calculating min t.
 
size_t endIndex () const
 The start index for calculating max t.
 
size_t controlPointCount () const
 Returns the number of control points.
 
size_t knotCount () const
 Returns the knot count.
 
double knot (size_t index) const
 returns a knot
 
bool isClamped () const
 Returns true, if the NURBS is clamped.
 
bool isClosed () const
 Returns true, if NURBS is closed.
 
uint32 degree () const
 Returns the degree.
 
jm::Vertex3 controlPoint (size_t index) const
 
double weight (size_t index) const
 
double N (size_t i, uint32 k, double t)
 This method returns the value of N_i,k(t).
 
double R (size_t i, uint32 k, double t)
 This method returns the weight of the control points R_i,k(t).
 
- Public Member Functions inherited from jm::Object
 Object () noexcept
 Constructor.
 
virtual ~Object () noexcept
 Destructor.
 
void release () noexcept
 Decreases the reference counter and releases the object immediately when the reference counter becomes 0.
 
Objectretain () noexcept
 Increases the reference counter of this object by 1.
 
Objectautorelease () noexcept
 Same function as release(), but releases the object with a delay if the reference counter is 0. AutoreleasePool::drain() must be called in the to release the object.
 
int32 referenceCount () const noexcept
 Returns the value of the reference counter.
 
virtual bool equals (const Object *other) const
 Comparison of objects.
 
virtual String displayName () const
 Returns the display name of the object intended to present to a user.
 
virtual void printDiffInfo (DiffOperation operation, Object *other) const
 Output method for outputting the diff results for the diff algorithm.
 
void setHighBit (bool status) noexcept
 
bool highBit () const noexcept
 

Detailed Description

NURBS (nonuniform rational basis splines) are a generalized form of B-Splines. They allow for modeling many curves, including projected forms. DXF splines, for example, are based on NURBS. This class provides functions and methods to work with NURBS.

Advantages of NURBS (http://www-lehre.inf.uos.de/~cg/2006/PDF/kap-07.pdf):

Constructor & Destructor Documentation

◆ Nurbs() [1/2]

jm::Nurbs::Nurbs ( )

Default constructor for the Nurbs class.

◆ Nurbs() [2/2]

jm::Nurbs::Nurbs ( uint32  degree,
const Vertex3 controlpoints,
size_t  controlCount,
const double *  knots,
size_t  knotCount,
const double *  weights,
size_t  weightCount 
)

Constructor for the Nurbs class.

Parameters
degreeThe degree of the polynomial.
controlpointsAn array of control points.
controlCountThe length of the controlpoints array.
knotsAn array of knots.
knotCountThe length of the knots array.
weightsAn array of weights.
weightCountThe length of the weights array.

◆ ~Nurbs()

jm::Nurbs::~Nurbs ( )
override

Destructor.

Member Function Documentation

◆ controlPoint()

jm::Vertex3 jm::Nurbs::controlPoint ( size_t  index) const

◆ controlPointCount()

size_t jm::Nurbs::controlPointCount ( ) const

Returns the number of control points.

◆ degree()

uint32 jm::Nurbs::degree ( ) const

Returns the degree.

◆ end()

double jm::Nurbs::end ( ) const

This method returns the maximum value of t.

◆ endIndex()

size_t jm::Nurbs::endIndex ( ) const

The start index for calculating max t.

◆ isClamped()

bool jm::Nurbs::isClamped ( ) const

Returns true, if the NURBS is clamped.

◆ isClosed()

bool jm::Nurbs::isClosed ( ) const

Returns true, if NURBS is closed.

◆ knot()

double jm::Nurbs::knot ( size_t  index) const

returns a knot

◆ knotCount()

size_t jm::Nurbs::knotCount ( ) const

Returns the knot count.

◆ N()

double jm::Nurbs::N ( size_t  i,
uint32  k,
double  t 
)

This method returns the value of N_i,k(t).

Parameters
iThe index of the control point.
kThe degree of the polynomial for which N is returned. (Not necessarily the degree of the NURBS)
tThe parameter value along the curve.
Returns
The value of N_i,k(t) at the given parameter value.

◆ point()

Vertex3 jm::Nurbs::point ( double  t)

Returns a point on the curve at a given parameter value.

Parameters
tThe parameter value on the curve. Should be in the range [0, t_max].
Returns
The point on the curve at the given parameter value.

◆ R()

double jm::Nurbs::R ( size_t  i,
uint32  k,
double  t 
)

This method returns the weight of the control points R_i,k(t).

Parameters
iThe index of the control point.
kThe degree of the polynomial for which R is returned.
tThe parameter value along the curve.
Returns
The weight of the control point at the given parameter value.

◆ start()

double jm::Nurbs::start ( ) const

This method returns the smallest value of t.

◆ startIndex()

size_t jm::Nurbs::startIndex ( ) const

The start index for calculating min t.

◆ weight()

double jm::Nurbs::weight ( size_t  index) const