15 #include "egg_parametrics.h" 16 #include "config_egg2pg.h" 31 <<
"Invalid NURBSSurface U order for " << egg_surface->get_name() <<
": " 38 <<
"Invalid NURBSSurface V order for " << egg_surface->get_name() <<
": " 50 nurbs->reset(num_u_vertices, num_v_vertices);
51 for (
int ui = 0; ui < num_u_vertices; ui++) {
52 for (
int vi = 0; vi < num_v_vertices; vi++) {
55 nurbs->set_vertex(ui, vi, LCAST(PN_stdfloat, egg_vertex->
get_pos4() * mat));
58 nurbs->set_extended_vertices(ui, vi, 0, color.
get_data(), 4);
63 if (num_u_knots != nurbs->get_num_u_knots()) {
65 <<
"Invalid NURBSSurface number of U knots for " 66 << egg_surface->get_name() <<
": got " << num_u_knots
67 <<
" knots, expected " << nurbs->get_num_u_knots() <<
"\n";
72 if (num_v_knots != nurbs->get_num_v_knots()) {
74 <<
"Invalid NURBSSurface number of U knots for " 75 << egg_surface->get_name() <<
": got " << num_v_knots
76 <<
" knots, expected " << nurbs->get_num_v_knots() <<
"\n";
81 for (i = 0; i < num_u_knots; i++) {
82 nurbs->set_u_knot(i, egg_surface->
get_u_knot(i));
84 for (i = 0; i < num_v_knots; i++) {
85 nurbs->set_v_knot(i, egg_surface->
get_v_knot(i));
104 <<
"Invalid NURBSCurve order for " << egg_curve->get_name() <<
": " 110 nurbs->set_order(egg_curve->
get_order());
112 nurbs->reset(egg_curve->size());
113 EggPrimitive::const_iterator pi;
115 for (pi = egg_curve->begin(); pi != egg_curve->end(); ++pi) {
117 nurbs->set_vertex(vi, LCAST(PN_stdfloat, egg_vertex->
get_pos4() * mat));
119 nurbs->set_extended_vertices(vi, 0, color.
get_data(), 4);
124 if (num_knots != nurbs->get_num_knots()) {
126 <<
"Invalid NURBSCurve number of knots for " 127 << egg_curve->get_name() <<
": got " << num_knots
128 <<
" knots, expected " << nurbs->get_num_knots() <<
"\n";
132 for (
int i = 0; i < num_knots; i++) {
133 nurbs->set_knot(i, egg_curve->
get_knot(i));
int get_order() const
Returns the order of the curve.
const float * get_data() const
Returns the address of the first of the four data elements in the vector.
This is a 4-by-4 transform matrix.
int get_num_v_knots() const
Returns the number of knots in the V direction.
int get_num_u_cvs() const
Returns the number of control vertices that should be present in the U direction. ...
This class is an abstraction for evaluating NURBS curves.
double get_u_knot(int k) const
Returns the nth knot value defined in the U direction.
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...
This class is an abstraction for evaluating NURBS surfaces.
LColor get_color() const
Returns the color set on this particular attribute.
int get_num_v_cvs() const
Returns the number of control vertices that should be present in the V direction. ...
int get_u_order() const
Returns the order of the surface in the U direction.
double get_knot(int k) const
Returns the nth knot value defined.
Any one-, two-, three-, or four-component vertex, possibly with attributes such as a normal...
int get_num_knots() const
Returns the number of knots.
A parametric NURBS curve.
int get_v_order() const
Returns the order of the surface in the V direction.
This is the base class for all three-component vectors and points.
A parametric NURBS surface.
double get_v_knot(int k) const
Returns the nth knot value defined in the V direction.
LPoint4d get_pos4() const
This is always valid, regardless of the value of get_num_dimensions.
int get_num_u_knots() const
Returns the number of knots in the U direction.
EggVertex * get_vertex(int index) const
Returns a particular index based on its index number.