Panda3D
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties
Public Member Functions | Static Public Member Functions
EggNurbsCurve Class Reference

A parametric NURBS curve. More...

Inheritance diagram for EggNurbsCurve:
EggCurve EggPrimitive EggNode EggAttributes EggRenderMode EggNamedObject MemoryBase EggObject

List of all members.

Public Member Functions

 EggNurbsCurve (EggNurbsCurve const copy)
 EggNurbsCurve (string name)
 EggNurbsCurve ()
int getDegree ()
 Returns the degree of the curve.
double getKnot (int k)
 Returns the nth knot value defined.
list getKnots ()
int getNumCvs ()
 Returns the total number of control vertices that should* be defined for the curve.
int getNumKnots ()
 Returns the number of knots.
int getOrder ()
 Returns the order of the curve.
bool isClosed ()
 Returns true if the curve appears to be closed.
bool isValid ()
 Returns true if the NURBS parameters are all internally consistent (e.g.
EggNurbsCurve operator= (EggNurbsCurve const copy)
 setKnot (int k, double value)
 Resets the value of the indicated knot as indicated.
 setNumKnots (int num)
 Directly changes the number of knots.
 setOrder (int order)
 Directly changes the order to the indicated value (which must be an integer in the range 1 <= order <= 4).
 setup (int order, int num_knots)
 Prepares a new curve definition with the indicated order and number of knots.

Static Public Member Functions

static TypeHandle getClassType ()

Detailed Description

A parametric NURBS curve.


Constructor & Destructor Documentation

EggNurbsCurve ( EggNurbsCurve const  copy)
EggNurbsCurve ( string  name)

Member Function Documentation

static TypeHandle getClassType ( ) [static]

Reimplemented from EggCurve.

int getDegree ( )

Returns the degree of the curve.

For a typical NURBS, the degree is 3.

double getKnot ( int  k)

Returns the nth knot value defined.

list getKnots ( )
int getNumCvs ( )

Returns the total number of control vertices that should* be defined for the curve.

This is determined by the number of knots and the order, in each direction; it does not necessarily reflect the number of vertices that have actually been added to the curve. (However, if the number of vertices in the curve are wrong, the curve is invalid.)

int getNumKnots ( )

Returns the number of knots.

int getOrder ( )

Returns the order of the curve.

The order is the degree of the NURBS equation plus 1; for a typical NURBS, the order is 4. With this implementation of NURBS, the order must be in the range [1, 4].

bool isClosed ( )

Returns true if the curve appears to be closed.

Since the Egg syntax does not provide a means for explicit indication of closure, this has to be guessed at by examining the curve itself.

bool isValid ( )

Returns true if the NURBS parameters are all internally consistent (e.g.

it has the right number of vertices to match its number of knots and order in each dimension), or false otherwise.

EggNurbsCurve operator= ( EggNurbsCurve const  copy)
setKnot ( int  k,
double  value 
)

Resets the value of the indicated knot as indicated.

k must be in the range 0 <= k < get_num_knots(), and the value must be in the range get_knot(k - 1) <= value <= get_knot(k + 1).

setNumKnots ( int  num)

Directly changes the number of knots.

This will either add zero-valued knots onto the end, or truncate knot values from the end, depending on whether the list is being increased or decreased. If possible, it is preferable to use the setup() method instead of directly setting the number of knots, as this may result in an invalid curve.

setOrder ( int  order)

Directly changes the order to the indicated value (which must be an integer in the range 1 <= order <= 4).

If possible, it is preferable to use the setup() method instead of this method, since changing the order directly may result in an invalid curve.

setup ( int  order,
int  num_knots 
)

Prepares a new curve definition with the indicated order and number of knots.

This also implies a particular number of vertices as well (the number of knots minus the order), but it is up to the user to add the correct number of vertices to the curve by repeatedly calling push_back().

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties