# panda3d.core.NurbsSurfaceEvaluator¶

from panda3d.core import NurbsSurfaceEvaluator

class NurbsSurfaceEvaluator

Bases: ReferenceCount

This class is an abstraction for evaluating NURBS surfaces. It accepts an array of vertices, each of which may be in a different coordinate space (as defined by a NodePath), as well as an optional knot vector.

Inheritance diagram

__init__() → None
__init__(param0: NurbsSurfaceEvaluator) → None
evaluate(rel_to: NodePath) → NurbsSurfaceResult

Returns a NurbsSurfaceResult object that represents the result of applying the knots to all of the current values of the vertices, transformed into the indicated coordinate space.

Return type

NurbsSurfaceResult

getExtendedVertex(ui: int, vi: int, d: int) → float

Returns an n-dimensional vertex value. See setExtendedVertex(). This returns the value set for the indicated dimension, or 0.0 if nothing has been set.

getNumUKnots() → int

Returns the number of knot values in the surface in the U direction. This is based on the number of vertices and the order.

getNumUSegments() → int

Returns the number of piecewise continuous segments in the surface in the U direction. This is based on the knot vector.

getNumUVertices() → int

Returns the number of control vertices in the U direction on the surface. This is the number passed to the last call to reset().

getNumVKnots() → int

Returns the number of knot values in the surface in the V direction. This is based on the number of vertices and the order.

getNumVSegments() → int

Returns the number of piecewise continuous segments in the surface in the V direction. This is based on the knot vector.

getNumVVertices() → int

Returns the number of control vertices in the V direction on the surface. This is the number passed to the last call to reset().

getUKnot(i: int) → float

Returns the value of the nth knot.

getUKnots() → list
getUOrder() → int

Returns the order of the surface in the U direction as set by a previous call to setUOrder().

getVKnot(i: int) → float

Returns the value of the nth knot.

getVKnots() → list
getVOrder() → int

Returns the order of the surface in the V direction as set by a previous call to setVOrder().

getVertex(ui: int, vi: int) → LVecBase4

Returns the nth control vertex of the surface, relative to its indicated coordinate space.

Return type

LVecBase4

getVertex(ui: int, vi: int, rel_to: NodePath) → LVecBase4

Returns the nth control vertex of the surface, relative to the given coordinate space.

Return type

LVecBase4

getVertexSpace(ui: int, vi: int, rel_to: NodePath) → NodePath

Returns the coordinate space of the nth control vertex of the surface, expressed as a NodePath.

Return type

NodePath

normalizeUKnots() → None

Normalizes the knot sequence so that the parametric range of the surface in the U direction is 0 .. 1.

normalizeVKnots() → None

Normalizes the knot sequence so that the parametric range of the surface in the U direction is 0 .. 1.

output(out: ostream) → None
reset(num_u_vertices: int, num_v_vertices: int) → None

Resets all the vertices and knots to their default values, and sets the surface up with the indicated number of vertices. You must then call setVertex() repeatedly to fill in all of the vertex values appropriately.

setExtendedVertex(ui: int, vi: int, d: int, value: float) → None

Sets an n-dimensional vertex value. This allows definition of a NURBS surface or surface in a sparse n-dimensional space, typically used for associating additional properties (like color or joint membership) with each vertex of a surface.

The value d is an arbitrary integer value and specifies the dimension of question for this particular vertex. Any number of dimensions may be specified, and they need not be consecutive. If a value for a given dimension is not specified, is it implicitly 0.0.

The value is implicitly scaled by the homogenous weight value–that is, the fourth component of the value passed to setVertex(). This means the ordinary vertex must be set first, before the extended vertices can be set.

setExtendedVertices(ui: int, vi: int, d: int, values: PN_stdfloat_const_[], num_values: int) → None

Simultaneously sets several extended values in the slots d through (d + num_values - 1) from the num_values elements of the indicated array. This is equivalent to calling setExtendedVertex() num_values times. See setExtendedVertex().

setUKnot(i: int, knot: float) → None

Sets the value of the nth knot. Each knot value should be greater than or equal to the preceding value. If no knot values are set, a default knot vector is supplied.

setUOrder(u_order: int) → None

Sets the order of the surface in the U direction. This resets the knot vector to the default knot vector for the number of vertices.

The order must be 1, 2, 3, or 4, and the value is one more than the degree of the surface.

setVKnot(i: int, knot: float) → None

Sets the value of the nth knot. Each knot value should be greater than or equal to the preceding value. If no knot values are set, a default knot vector is supplied.

setVOrder(v_order: int) → None

Sets the order of the surface in the V direction. This resets the knot vector to the default knot vector for the number of vertices.

The order must be 1, 2, 3, or 4, and the value is one more than the degree of the surface.

setVertex(ui: int, vi: int, vertex: LVecBase3, weight: float) → None

Sets the nth control vertex of the surface. This flavor sets the vertex as a 3-d coordinate and a weight; the 3-d coordinate values are implicitly scaled up by the weight factor.

setVertex(ui: int, vi: int, vertex: LVecBase4) → None

Sets the nth control vertex of the surface, as a vertex in 4-d homogeneous space. In this form, the first three components of the vertex should already have been scaled by the fourth component, which is the homogeneous weight.

setVertexSpace(ui: int, vi: int, space: NodePath) → None

Sets the coordinate space of the nth control vertex. If this is not specified, or is set to an empty NodePath, the nth control vertex is deemed to be in the coordinate space passed to evaluate().

This specifies the space as a fixed NodePath, which is always the same NodePath. Also see setting the space as a path string, which can specify a different NodePath for different instances of the surface.

setVertexSpace(ui: int, vi: int, space: str) → None

Sets the coordinate space of the nth control vertex. If this is not specified, or is set to an empty string, the nth control vertex is deemed to be in the coordinate space passed to evaluate().

This specifies the space as a string, which describes the path to find the node relative to the rel_to NodePath when the surface is evaluated.

property u_knots
Getter

Returns the value of the nth knot.

Setter

Sets the value of the nth knot. Each knot value should be greater than or equal to the preceding value. If no knot values are set, a default knot vector is supplied.

Return type

Sequence[float]

property u_order
Getter

Returns the order of the surface in the U direction as set by a previous call to setUOrder().

Setter

Sets the order of the surface in the U direction. This resets the knot vector to the default knot vector for the number of vertices.

The order must be 1, 2, 3, or 4, and the value is one more than the degree of the surface.

Return type

int

property v_knots
Getter

Returns the value of the nth knot.

Setter

Sets the value of the nth knot. Each knot value should be greater than or equal to the preceding value. If no knot values are set, a default knot vector is supplied.

Return type

Sequence[float]

property v_order
Getter

Returns the order of the surface in the V direction as set by a previous call to setVOrder().

Setter

Sets the order of the surface in the V direction. This resets the knot vector to the default knot vector for the number of vertices.

The order must be 1, 2, 3, or 4, and the value is one more than the degree of the surface.

Return type

int