37 int num_u_knots,
int num_v_knots) {
44 _u_knots.reserve(num_u_knots);
45 for (i = 0; i < num_u_knots; i++) {
46 _u_knots.push_back((
double)i);
48 _v_knots.reserve(num_v_knots);
49 for (i = 0; i < num_v_knots; i++) {
50 _v_knots.push_back((
double)i);
63 if ((
int)_u_knots.size() >= num) {
65 _u_knots.erase(_u_knots.begin() + num, _u_knots.end());
68 _u_knots.reserve(num);
69 for (
int i = _u_knots.size(); i < num; i++) {
70 _u_knots.push_back(0.0);
84 if ((
int)_v_knots.size() >= num) {
86 _v_knots.erase(_v_knots.begin() + num, _v_knots.end());
89 _v_knots.reserve(num);
90 for (
int i = _v_knots.size(); i < num; i++) {
91 _v_knots.push_back(0.0);
103 if (_u_order < 1 || _u_order > 4 || _v_order < 1 || _v_order > 4) {
171 write(std::ostream &out,
int indent_level)
const {
174 Trims::const_iterator ti;
175 for (ti = _trims.begin(); ti != _trims.end(); ++ti) {
176 indent(out, indent_level + 2) <<
"<Trim> {\n";
177 Loops::const_iterator li;
178 for (li = (*ti).begin(); li != (*ti).end(); ++li) {
179 indent(out, indent_level + 4) <<
"<Loop> {\n";
180 Curves::const_iterator ci;
181 for (ci = (*li).begin(); ci != (*li).end(); ++ci) {
182 (*ci)->write(out, indent_level + 6);
184 indent(out, indent_level + 4) <<
"}\n";
186 indent(out, indent_level + 2) <<
"}\n";
190 indent(out, indent_level + 2)
194 indent(out, indent_level + 2)
197 indent(out, indent_level + 2)
199 indent(out, indent_level + 2)
203 indent(out, indent_level + 2)
205 indent(out, indent_level + 2)
209 indent(out, indent_level + 2)
212 write_body(out, indent_level+2);
214 Curves::const_iterator ci;
215 for (ci = _curves_on_surface.begin(); ci != _curves_on_surface.end(); ++ci) {
216 (*ci)->write(out, indent_level + 2);
219 indent(out, indent_level) <<
"}\n";
225 void EggNurbsSurface::
get_num_v_knots
Returns the number of knots in the V direction.
void write_header(std::ostream &out, int indent_level, const char *egg_keyword) const
Writes the first line of the egg object, e.g.
get_num_u_knots
Returns the number of knots in the U direction.
void set_num_v_knots(int num)
Directly changes the number of knots in the V direction.
get_v_knot
Returns the nth knot value defined in the V direction.
int get_v_subdiv() const
Returns the requested number of subdivisions in the U direction, or 0 if no particular subdivisions h...
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.
bool is_closed_v() const
Returns true if the surface appears to be closed in the V direction.
bool is_valid() const
Returns true if the NURBS parameters are all internally consistent (e.g.
int get_u_order() const
Returns the order of the surface in the U direction.
void set_num_u_knots(int num)
Directly changes the number of knots in the U direction.
int get_num_cvs() const
Returns the total number of control vertices that *should* be defined for the surface.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
void write_long_list(std::ostream &out, int indent_level, InputIterator ifirst, InputIterator ilast, std::string first_prefix="", std::string later_prefix="", int max_col=72)
Writes a list of things to the indicated output stream, with a space separating each item.
int get_v_order() const
Returns the order of the surface in the V direction.
bool is_closed_u() const
Returns true if the surface appears to be closed in the U direction.
get_u_knot
Returns the nth knot value defined in the U direction.
virtual void write(std::ostream &out, int indent_level) const override
Writes the nurbsSurface to the indicated output stream in Egg format.
A parametric NURBS surface.
TypeHandle is the identifier used to differentiate C++ class types.
virtual EggNurbsSurface * make_copy() const override
Makes a copy of this object.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
int get_u_subdiv() const
Returns the requested number of subdivisions in the U direction, or 0 if no particular subdivisions h...