# panda3d.egg.EggNurbsCurve¶

class EggNurbsCurve

Bases: EggCurve

A parametric NURBS curve.

Inheritance diagram

__init__(copy: EggNurbsCurve) → None
__init__(name: str) → None
assign(copy: EggNurbsCurve) → EggNurbsCurve
Return type

EggNurbsCurve

setup(order: int, num_knots: int) → None

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

setOrder(order: int) → None

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.

setNumKnots(num: int) → None

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.

setKnot(k: int, value: float) → None

Resets the value of the indicated knot as indicated. k must be in the range 0 <= k < getNumKnots(), and the value must be in the range get_knot(k - 1) <= value <= get_knot(k + 1).

isValid() → bool

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.

getOrder() → int

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].

getDegree() → int

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

getNumKnots() → int

Returns the number of knots.

getNumCvs() → int

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

isClosed() → bool

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.

getKnot(k: int) → float

Returns the nth knot value defined.

static getClassType() → TypeHandle
Return type

TypeHandle

getKnots() → list
property order
Getter

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].

Setter

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.

Return type

int

property degree

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

Return type

int

property closed

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.

Return type

bool

property knots
Getter

Returns the nth knot value defined.

Setter

Resets the value of the indicated knot as indicated. k must be in the range 0 <= k < getNumKnots(), and the value must be in the range get_knot(k - 1) <= value <= get_knot(k + 1).

Return type

Sequence[float]