15 #include "eggNurbsSurface.h"
34 int num_u_knots,
int num_v_knots) {
41 _u_knots.reserve(num_u_knots);
42 for (i = 0; i < num_u_knots; i++) {
43 _u_knots.push_back((
double)i);
45 _v_knots.reserve(num_v_knots);
46 for (i = 0; i < num_v_knots; i++) {
47 _v_knots.push_back((
double)i);
64 if ((
int)_u_knots.size() >= num) {
66 _u_knots.erase(_u_knots.begin() + num, _u_knots.end());
69 _u_knots.reserve(num);
70 for (
int i = _u_knots.size(); i < num; i++) {
71 _u_knots.push_back(0.0);
89 if ((
int)_v_knots.size() >= num) {
91 _v_knots.erase(_v_knots.begin() + num, _v_knots.end());
94 _v_knots.reserve(num);
95 for (
int i = _v_knots.size(); i < num; i++) {
96 _v_knots.push_back(0.0);
111 if (_u_order < 1 || _u_order > 4 || _v_order < 1 || _v_order > 4) {
191 write(ostream &out,
int indent_level)
const {
194 Trims::const_iterator ti;
195 for (ti = _trims.begin(); ti != _trims.end(); ++ti) {
196 indent(out, indent_level + 2) <<
"<Trim> {\n";
197 Loops::const_iterator li;
198 for (li = (*ti).begin(); li != (*ti).end(); ++li) {
199 indent(out, indent_level + 4) <<
"<Loop> {\n";
200 Curves::const_iterator ci;
201 for (ci = (*li).begin(); ci != (*li).end(); ++ci) {
202 (*ci)->write(out, indent_level + 6);
204 indent(out, indent_level + 4) <<
"}\n";
206 indent(out, indent_level + 2) <<
"}\n";
210 indent(out, indent_level + 2)
214 indent(out, indent_level + 2)
217 indent(out, indent_level + 2)
219 indent(out, indent_level + 2)
221 write_long_list(out, indent_level+4, _u_knots.begin(), _u_knots.end(),
223 indent(out, indent_level + 2)
225 indent(out, indent_level + 2)
227 write_long_list(out, indent_level+4, _v_knots.begin(), _v_knots.end(),
229 indent(out, indent_level + 2)
232 write_body(out, indent_level+2);
234 Curves::const_iterator ci;
235 for (ci = _curves_on_surface.begin(); ci != _curves_on_surface.end(); ++ci) {
236 (*ci)->write(out, indent_level + 2);
239 indent(out, indent_level) <<
"}\n";
247 void EggNurbsSurface::
void write_header(ostream &out, int indent_level, const char *egg_keyword) const
Writes the first line of the egg object, e.g.
int get_num_u_knots() const
Returns the number of knots in the U direction.
double get_u_knot(int k) const
Returns the nth knot value defined in the U direction.
void set_num_v_knots(int num)
Directly changes the number of knots in the V direction.
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 is a collection of textures by TRef name.
virtual void write(ostream &out, int indent_level) const
Writes the nurbsSurface to the indicated output stream in Egg format.
int get_v_subdiv() const
Returns the requested number of subdivisions in the U direction, or 0 if no particular subdivisions h...
bool is_closed_u() const
Returns true if the surface appears to be closed in the U direction.
void set_num_u_knots(int num)
Directly changes the number of knots in the U direction.
int get_v_order() const
Returns the order of the surface in the V direction.
int get_u_subdiv() const
Returns the requested number of subdivisions in the U direction, or 0 if no particular subdivisions h...
int get_num_cvs() const
Returns the total number of control vertices that should* be defined for the surface.
bool is_closed_v() const
Returns true if the surface appears to be closed in the V direction.
TypeHandle is the identifier used to differentiate C++ class types.
int get_num_v_knots() const
Returns the number of knots in the V direction.
double get_v_knot(int k) const
Returns the nth knot value defined in the V direction.
int get_u_order() const
Returns the order of the surface in the U direction.
bool is_valid() const
Returns true if the NURBS parameters are all internally consistent (e.g.