Panda3D
Public Member Functions | Public Attributes | List of all members
NurbsSurfaceEvaluator Class Reference

This class is an abstraction for evaluating NURBS surfaces. More...

Inheritance diagram for NurbsSurfaceEvaluator:
ReferenceCount

Public Member Functions

 __init__ ()
 
 __init__ (const NurbsSurfaceEvaluator)
 
NurbsSurfaceResult evaluate (const NodePath rel_to)
 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. More...
 
float getExtendedVertex (int ui, int vi, int d)
 Returns an n-dimensional vertex value. More...
 
int getNumUKnots ()
 Returns the number of knot values in the surface in the U direction. More...
 
int getNumUSegments ()
 Returns the number of piecewise continuous segments in the surface in the U direction. More...
 
int getNumUVertices ()
 Returns the number of control vertices in the U direction on the surface. More...
 
int getNumVKnots ()
 Returns the number of knot values in the surface in the V direction. More...
 
int getNumVSegments ()
 Returns the number of piecewise continuous segments in the surface in the V direction. More...
 
int getNumVVertices ()
 Returns the number of control vertices in the V direction on the surface. More...
 
float getUKnot (int i)
 Returns the value of the nth knot. More...
 
list getUKnots ()
 
int getUOrder ()
 Returns the order of the surface in the U direction as set by a previous call to set_u_order(). More...
 
const LVecBase4 getVertex (int ui, int vi)
 Returns the nth control vertex of the surface, relative to its indicated coordinate space. More...
 
LVecBase4 getVertex (int ui, int vi, const NodePath rel_to)
 Returns the nth control vertex of the surface, relative to the given coordinate space. More...
 
NodePath getVertexSpace (int ui, int vi, const NodePath rel_to)
 Returns the coordinate space of the nth control vertex of the surface, expressed as a NodePath. More...
 
float getVKnot (int i)
 Returns the value of the nth knot. More...
 
list getVKnots ()
 
int getVOrder ()
 Returns the order of the surface in the V direction as set by a previous call to set_v_order(). More...
 
 normalizeUKnots ()
 Normalizes the knot sequence so that the parametric range of the surface in the U direction is 0 . More...
 
 normalizeVKnots ()
 Normalizes the knot sequence so that the parametric range of the surface in the U direction is 0 . More...
 
 output (Ostream out)
 
 reset (int num_u_vertices, int num_v_vertices)
 Resets all the vertices and knots to their default values, and sets the surface up with the indicated number of vertices. More...
 
 setExtendedVertex (int ui, int vi, int d, float value)
 Sets an n-dimensional vertex value. More...
 
 setExtendedVertices (int ui, int vi, int d, PNStdfloatConst[] values, int num_values)
 Simultaneously sets several extended values in the slots d through (d + num_values - 1) from the num_values elements of the indicated array. More...
 
 setUKnot (int i, float knot)
 Sets the value of the nth knot. More...
 
 setUOrder (int u_order)
 Sets the order of the surface in the U direction. More...
 
 setVertex (int ui, int vi, const LVecBase3 vertex, float weight)
 Sets the nth control vertex of the surface. More...
 
 setVertex (int ui, int vi, const LVecBase4 vertex)
 Sets the nth control vertex of the surface, as a vertex in 4-d homogeneous space. More...
 
 setVertexSpace (int ui, int vi, const NodePath space)
 Sets the coordinate space of the nth control vertex. More...
 
 setVertexSpace (int ui, int vi, str space)
 Sets the coordinate space of the nth control vertex. More...
 
 setVKnot (int i, float knot)
 Sets the value of the nth knot. More...
 
 setVOrder (int v_order)
 Sets the order of the surface in the V direction. More...
 
- Public Member Functions inherited from ReferenceCount
int getRefCount ()
 Returns the current reference count. More...
 
 ref ()
 Explicitly increments the reference count. More...
 
bool testRefCountIntegrity ()
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
bool testRefCountNonzero ()
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More...
 
bool unref ()
 Explicitly decrements the reference count. More...
 

Public Attributes

float u_knots []
 
int u_order
 Returns the order of the surface in the U direction as set by a previous call to set_u_order(). More...
 
float v_knots []
 
int v_order
 Returns the order of the surface in the V direction as set by a previous call to set_v_order(). More...
 
- Public Attributes inherited from ReferenceCount
int ref_count
 The current reference count. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ReferenceCount
static TypeHandle getClassType ()
 

Detailed Description

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.

Member Function Documentation

◆ __init__() [1/2]

__init__ ( )

◆ __init__() [2/2]

__init__ ( const  NurbsSurfaceEvaluator)

◆ evaluate()

NurbsSurfaceResult evaluate ( const NodePath  rel_to)

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.

◆ getExtendedVertex()

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

Returns an n-dimensional vertex value.

See set_extended_vertex(). This returns the value set for the indicated dimension, or 0.0 if nothing has been set.

◆ getNumUKnots()

int getNumUKnots ( )

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

Returns the number of piecewise continuous segments in the surface in the U direction.

This is based on the knot vector.

◆ getNumUVertices()

int getNumUVertices ( )

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

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

Returns the number of piecewise continuous segments in the surface in the V direction.

This is based on the knot vector.

◆ getNumVVertices()

int getNumVVertices ( )

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

float getUKnot ( int  i)

Returns the value of the nth knot.

◆ getUKnots()

list getUKnots ( )

◆ getUOrder()

int getUOrder ( )

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

◆ getVertex() [1/2]

const LVecBase4 getVertex ( int  ui,
int  vi 
)

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

◆ getVertex() [2/2]

LVecBase4 getVertex ( int  ui,
int  vi,
const NodePath  rel_to 
)

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

◆ getVertexSpace()

NodePath getVertexSpace ( int  ui,
int  vi,
const NodePath  rel_to 
)

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

◆ getVKnot()

float getVKnot ( int  i)

Returns the value of the nth knot.

◆ getVKnots()

list getVKnots ( )

◆ getVOrder()

int getVOrder ( )

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

◆ normalizeUKnots()

normalizeUKnots ( )

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

. 1.

◆ normalizeVKnots()

normalizeVKnots ( )

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

. 1.

◆ output()

output ( Ostream  out)

◆ reset()

reset ( int  num_u_vertices,
int  num_v_vertices 
)

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 set_vertex() repeatedly to fill in all of the vertex values appropriately.

◆ setExtendedVertex()

setExtendedVertex ( int  ui,
int  vi,
int  d,
float  value 
)

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 set_vertex(). This means the ordinary vertex must be set first, before the extended vertices can be set.

◆ setExtendedVertices()

setExtendedVertices ( int  ui,
int  vi,
int  d,
PNStdfloatConst []  values,
int  num_values 
)

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 set_extended_vertex() num_values times. See set_extended_vertex().

◆ setUKnot()

setUKnot ( int  i,
float  knot 
)

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

setUOrder ( int  u_order)

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.

◆ setVertex() [1/2]

setVertex ( int  ui,
int  vi,
const LVecBase3  vertex,
float  weight 
)

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() [2/2]

setVertex ( int  ui,
int  vi,
const LVecBase4  vertex 
)

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() [1/2]

setVertexSpace ( int  ui,
int  vi,
const NodePath  space 
)

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() [2/2]

setVertexSpace ( int  ui,
int  vi,
str  space 
)

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.

◆ setVKnot()

setVKnot ( int  i,
float  knot 
)

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

setVOrder ( int  v_order)

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.

Member Data Documentation

◆ u_knots

float u_knots[]

◆ u_order

int u_order

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

◆ v_knots

float v_knots[]

◆ v_order

int v_order

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