# EggNurbsSurface¶

class EggNurbsSurface

Bases: EggSurface

A parametric NURBS surface.

Inheritance diagram

typedef std::list<PointerTo<EggNurbsCurve>> EggNurbsSurface::Curves

alias of list< PointerTo< EggNurbsCurve > >

typedef EggNurbsSurface::Curves EggNurbsSurface::Loop

alias of Curves

typedef std::list<Loop> EggNurbsSurface::Loops

alias of list< Loop >

typedef EggNurbsSurface::Loops EggNurbsSurface::Trim

alias of Loops

typedef std::list<Trim> EggNurbsSurface::Trims

alias of list< Trim >

explicit EggNurbsSurface(std::string const &name = "")
EggNurbsSurface(EggNurbsSurface const &copy)
static TypeHandle get_class_type(void)
EggVertex *get_cv(int ui, int vi) const

Returns the control vertex at the indicate U, V position.

int get_num_cvs(void) const

Returns the total number of control vertices that should be defined for the surface. 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 surface. (However, if the number of vertices in the surface are wrong, the surface is invalid.)

int get_num_u_cvs(void) const

Returns the number of control vertices that should be present in the U direction. This is determined by the number of knots and the order; it does not necessarily reflect the number of vertices that have actually been added to the surface. (However, if the number of vertices in the surface are wrong, the surface is invalid.)

int get_num_u_knots(void) const

Returns the number of knots in the U direction.

int get_num_v_cvs(void) const

Returns the number of control vertices that should be present in the V direction. This is determined by the number of knots and the order; it does not necessarily reflect the number of vertices that have actually been added to the surface. (However, if the number of vertices in the surface are wrong, the surface is invalid.)

int get_num_v_knots(void) const

Returns the number of knots in the V direction.

int get_u_degree(void) const

Returns the degree of the surface in the U direction. For a typical NURBS, the degree is 3.

int get_u_index(int vertex_index) const

Returns the U index number of the given vertex within the EggPrimitive’s linear list of vertices. An EggNurbsSurface maps a linear list of vertices to its 2-d mesh; this returns the U index number that corresponds to the nth vertex in the list.

double get_u_knot(int k) const

Returns the nth knot value defined in the U direction.

int get_u_order(void) const

Returns the order of the surface in the U direction. 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].

int get_v_degree(void) const

Returns the degree of the surface in the V direction. for a typical NURBS, the degree is 3.

int get_v_index(int vertex_index) const

Returns the V index number of the given vertex within the EggPrimitive’s linear list of vertices. An EggNurbsSurface maps a linear list of vertices to its 2-d mesh; this returns the V index number that corresponds to the nth vertex in the list.

double get_v_knot(int k) const

Returns the nth knot value defined in the V direction.

int get_v_order(void) const

Returns the order of the surface in the V direction. 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].

int get_vertex_index(int ui, int vi) const

Returns the index number within the EggPrimitive’s list of the control vertex at position ui, vi.

bool is_closed_u(void) const

Returns true if the surface appears to be closed in the U direction. Since the Egg syntax does not provide a means for explicit indication of closure, this has to be guessed at by examining the surface itself.

bool is_closed_v(void) const

Returns true if the surface appears to be closed in the V direction. Since the Egg syntax does not provide a means for explicit indication of closure, this has to be guessed at by examining the surface 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_cv(int ui, int vi, EggVertex *vertex)

Redefines the control vertex associated with a particular u, v coordinate pair. This is just a shorthand to access the EggPrimitive’s normal vertex assignment for a 2-d control vertex.

void set_num_u_knots(int num)

Directly changes the number of knots in the U direction. 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 surface.

void set_num_v_knots(int num)

Directly changes the number of knots in the V direction. 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 surface.

void set_u_knot(int k, double value)

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

void set_u_order(int u_order)

Directly changes the order in the U direction to the indicated value (which must be an integer in the range 1 <= u_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 surface.

void set_v_knot(int k, double value)

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

void set_v_order(int v_order)

Directly changes the order in the V direction to the indicated value (which must be an integer in the range 1 <= v_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 surface.

void setup(int u_order, int v_order, int num_u_knots, int num_v_knots)

Prepares a new surface definition with the indicated order and number of knots in each dimension. This also implies a particular number of vertices in each dimension 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 surface by repeatedly calling push_back().