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

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

#include "nurbsSurfaceEvaluator.h"

Inheritance diagram for NurbsSurfaceEvaluator:
ReferenceCount MemoryBase

Public Types

typedef pvector< LPoint3 > Vert3Array
 
typedef epvector< LVecBase4 > Vert4Array
 

Public Member Functions

PN_stdfloat get_extended_vertex (int ui, int vi, int d) const
 Returns an n-dimensional vertex value. More...
 
int get_num_u_knots () const
 
int get_num_u_segments () const
 Returns the number of piecewise continuous segments in the surface in the U direction. More...
 
int get_num_u_vertices () const
 Returns the number of control vertices in the U direction on the surface. More...
 
int get_num_v_knots () const
 
int get_num_v_segments () const
 Returns the number of piecewise continuous segments in the surface in the V direction. More...
 
int get_num_v_vertices () const
 Returns the number of control vertices in the V direction on the surface. More...
 
PN_stdfloat get_u_knot (int i) const
 
int get_u_order () const
 
PN_stdfloat get_v_knot (int i) const
 
int get_v_order () const
 
const LVecBase4 & get_vertex (int ui, int vi) const
 Returns the nth control vertex of the surface, relative to its indicated coordinate space. More...
 
LVecBase4 get_vertex (int ui, int vi, const NodePath &rel_to) const
 Returns the nth control vertex of the surface, relative to the given coordinate space. More...
 
NodePath get_vertex_space (int ui, int vi, const NodePath &rel_to) const
 Returns the coordinate space of the nth control vertex of the surface, expressed as a NodePath. More...
 
void get_vertices (Vert4Array &verts, const NodePath &rel_to) const
 
void get_vertices (Vert3Array &verts, const NodePath &rel_to) const
 
void normalize_u_knots ()
 Normalizes the knot sequence so that the parametric range of the surface in the U direction is 0 . More...
 
void normalize_v_knots ()
 Normalizes the knot sequence so that the parametric range of the surface in the U direction is 0 . More...
 
void output (std::ostream &out) const
 
 PT (NurbsSurfaceResult) evaluate(const NodePath &rel_to
 
void 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...
 
void set_extended_vertex (int ui, int vi, int d, PN_stdfloat value)
 Sets an n-dimensional vertex value. More...
 
void set_extended_vertices (int ui, int vi, int d, const PN_stdfloat 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...
 
void set_u_knot (int i, PN_stdfloat knot)
 
void set_u_order (int u_order)
 
void set_v_knot (int i, PN_stdfloat knot)
 
void set_v_order (int v_order)
 
void set_vertex (int ui, int vi, const LVecBase4 &vertex)
 Sets the nth control vertex of the surface, as a vertex in 4-d homogeneous space. More...
 
void set_vertex (int ui, int vi, const LVecBase3 &vertex, PN_stdfloat weight=1.0)
 Sets the nth control vertex of the surface. More...
 
void set_vertex_space (int ui, int vi, const NodePath &space)
 Sets the coordinate space of the nth control vertex. More...
 
void set_vertex_space (int ui, int vi, const std::string &space)
 Sets the coordinate space of the nth control vertex. More...
 
- Public Member Functions inherited from ReferenceCount
int get_ref_count () const
 
WeakReferenceListget_weak_list () const
 Returns the WeakReferenceList associated with this ReferenceCount object. More...
 
bool has_weak_list () const
 Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. More...
 
void local_object ()
 This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. More...
 
void ref () const
 Explicitly increments the reference count. More...
 
bool ref_if_nonzero () const
 Atomically increases the reference count of this object if it is not zero. More...
 
bool test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
bool test_ref_count_nonzero () const
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More...
 
virtual bool unref () const
 Explicitly decrements the reference count. More...
 
WeakReferenceListweak_ref ()
 Adds the indicated PointerToVoid as a weak reference to this object. More...
 
void weak_unref ()
 Removes the indicated PointerToVoid as a weak reference to this object. More...
 

Public Attributes

 get_num_u_knots
 Returns the number of knot values in the surface in the U direction. More...
 
 get_num_v_knots
 Returns the number of knot values in the surface in the V direction. More...
 
 get_u_knot
 Returns the value of the nth knot. More...
 
 get_u_order
 Returns the order of the surface in the U direction as set by a previous call to set_u_order(). More...
 
 get_v_knot
 Returns the value of the nth knot. More...
 
 get_v_order
 Returns the order of the surface in the V direction as set by a previous call to set_v_order(). More...
 
 set_u_knot
 Sets the value of the nth knot. More...
 
 set_u_order
 Sets the order of the surface in the U direction. More...
 
 set_v_knot
 Sets the value of the nth knot. More...
 
 set_v_order
 Sets the order of the surface in the V direction. More...
 
- Public Attributes inherited from ReferenceCount
 get_ref_count
 Returns the current reference count. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ReferenceCount
static TypeHandle get_class_type ()
 
static void init_type ()
 

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.

Definition at line 34 of file nurbsSurfaceEvaluator.h.

Member Function Documentation

◆ get_extended_vertex()

PN_stdfloat NurbsSurfaceEvaluator::get_extended_vertex ( int  ui,
int  vi,
int  d 
) const
inline

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.

Definition at line 192 of file nurbsSurfaceEvaluator.I.

◆ get_num_u_segments()

int NurbsSurfaceEvaluator::get_num_u_segments ( ) const
inline

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

This is based on the knot vector.

Definition at line 221 of file nurbsSurfaceEvaluator.I.

References NurbsBasisVector::get_num_segments().

◆ get_num_u_vertices()

int NurbsSurfaceEvaluator::get_num_u_vertices ( ) const
inline

Returns the number of control vertices in the U direction on the surface.

This is the number passed to the last call to reset().

Definition at line 65 of file nurbsSurfaceEvaluator.I.

◆ get_num_v_segments()

int NurbsSurfaceEvaluator::get_num_v_segments ( ) const
inline

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

This is based on the knot vector.

Definition at line 233 of file nurbsSurfaceEvaluator.I.

References NurbsBasisVector::get_num_segments().

◆ get_num_v_vertices()

int NurbsSurfaceEvaluator::get_num_v_vertices ( ) const
inline

Returns the number of control vertices in the V direction on the surface.

This is the number passed to the last call to reset().

Definition at line 74 of file nurbsSurfaceEvaluator.I.

◆ get_vertex() [1/2]

const LVecBase4 & NurbsSurfaceEvaluator::get_vertex ( int  ui,
int  vi 
) const
inline

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

Definition at line 108 of file nurbsSurfaceEvaluator.I.

◆ get_vertex() [2/2]

LVecBase4 NurbsSurfaceEvaluator::get_vertex ( int  ui,
int  vi,
const NodePath rel_to 
) const
inline

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

Definition at line 119 of file nurbsSurfaceEvaluator.I.

◆ get_vertex_space()

NodePath NurbsSurfaceEvaluator::get_vertex_space ( int  ui,
int  vi,
const NodePath rel_to 
) const

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

Definition at line 63 of file nurbsSurfaceEvaluator.cxx.

◆ normalize_u_knots()

void NurbsSurfaceEvaluator::normalize_u_knots ( )

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

. 1.

Definition at line 121 of file nurbsSurfaceEvaluator.cxx.

◆ normalize_v_knots()

void NurbsSurfaceEvaluator::normalize_v_knots ( )

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

. 1.

Definition at line 169 of file nurbsSurfaceEvaluator.cxx.

◆ reset()

void NurbsSurfaceEvaluator::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.

Definition at line 42 of file nurbsSurfaceEvaluator.cxx.

◆ set_extended_vertex()

void NurbsSurfaceEvaluator::set_extended_vertex ( int  ui,
int  vi,
int  d,
PN_stdfloat  value 
)
inline

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.

Definition at line 180 of file nurbsSurfaceEvaluator.I.

◆ set_extended_vertices()

void NurbsSurfaceEvaluator::set_extended_vertices ( int  ui,
int  vi,
int  d,
const PN_stdfloat  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().

Definition at line 79 of file nurbsSurfaceEvaluator.cxx.

◆ set_vertex() [1/2]

void NurbsSurfaceEvaluator::set_vertex ( int  ui,
int  vi,
const LVecBase4 &  vertex 
)
inline

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.

Definition at line 85 of file nurbsSurfaceEvaluator.I.

◆ set_vertex() [2/2]

void NurbsSurfaceEvaluator::set_vertex ( int  ui,
int  vi,
const LVecBase3 &  vertex,
PN_stdfloat  weight = 1.0 
)
inline

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.

Definition at line 97 of file nurbsSurfaceEvaluator.I.

◆ set_vertex_space() [1/2]

void NurbsSurfaceEvaluator::set_vertex_space ( int  ui,
int  vi,
const NodePath space 
)
inline

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.

Definition at line 143 of file nurbsSurfaceEvaluator.I.

◆ set_vertex_space() [2/2]

void NurbsSurfaceEvaluator::set_vertex_space ( int  ui,
int  vi,
const std::string &  space 
)
inline

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.

Definition at line 158 of file nurbsSurfaceEvaluator.I.

Member Data Documentation

◆ get_num_u_knots

int NurbsSurfaceEvaluator::get_num_u_knots
inline

Returns the number of knot values in the surface in the U direction.

This is based on the number of vertices and the order.

Definition at line 66 of file nurbsSurfaceEvaluator.h.

◆ get_num_v_knots

int NurbsSurfaceEvaluator::get_num_v_knots
inline

Returns the number of knot values in the surface in the V direction.

This is based on the number of vertices and the order.

Definition at line 72 of file nurbsSurfaceEvaluator.h.

◆ get_u_knot

PN_stdfloat NurbsSurfaceEvaluator::get_u_knot

Returns the value of the nth knot.

Definition at line 66 of file nurbsSurfaceEvaluator.h.

◆ get_u_order

int NurbsSurfaceEvaluator::get_u_order
inline

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

Definition at line 82 of file nurbsSurfaceEvaluator.h.

◆ get_v_knot

PN_stdfloat NurbsSurfaceEvaluator::get_v_knot

Returns the value of the nth knot.

Definition at line 72 of file nurbsSurfaceEvaluator.h.

◆ get_v_order

int NurbsSurfaceEvaluator::get_v_order
inline

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

Definition at line 83 of file nurbsSurfaceEvaluator.h.

◆ set_u_knot

void NurbsSurfaceEvaluator::set_u_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.

Definition at line 84 of file nurbsSurfaceEvaluator.h.

◆ set_u_order

void NurbsSurfaceEvaluator::set_u_order
inline

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.

Definition at line 82 of file nurbsSurfaceEvaluator.h.

◆ set_v_knot

void NurbsSurfaceEvaluator::set_v_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.

Definition at line 85 of file nurbsSurfaceEvaluator.h.

◆ set_v_order

void NurbsSurfaceEvaluator::set_v_order
inline

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.

Definition at line 83 of file nurbsSurfaceEvaluator.h.


The documentation for this class was generated from the following files: