EggNurbsCurve

class EggNurbsCurve

Bases: EggCurve

A parametric NURBS curve.

Inheritance diagram

Inheritance diagram of EggNurbsCurve

explicit EggNurbsCurve(std::string const &name = "")
EggNurbsCurve(EggNurbsCurve const &copy)
static TypeHandle get_class_type(void)
int get_degree(void) const

Returns the degree of the curve. For a typical NURBS, the degree is 3.

double get_knot(int k) const

Returns the nth knot value defined.

int get_num_cvs(void) const

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 get_num_knots(void) const

Returns the number of knots.

int get_order(void) const

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 is_closed(void) const

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 is_valid(void) const

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.

void set_knot(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).

void set_num_knots(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.

void set_order(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.

void 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().