15 #include "eggNurbsCurve.h"
32 setup(
int order,
int num_knots) {
37 _knots.reserve(num_knots);
38 for (i = 0; i < num_knots; i++) {
39 _knots.push_back((
double)i);
56 if ((
int)_knots.size() >= num) {
58 _knots.erase(_knots.begin() + num, _knots.end());
62 for (
int i = _knots.size(); i < num; i++) {
63 _knots.push_back(0.0);
78 if (_order < 1 || _order > 4) {
132 write(ostream &out,
int indent_level)
const {
136 indent(out, indent_level + 2)
140 indent(out, indent_level + 2)
141 <<
"<Scalar> subdiv { " <<
get_subdiv() <<
" }\n";
143 indent(out, indent_level + 2)
144 <<
"<Order> { " <<
get_order() <<
" }\n";
145 indent(out, indent_level + 2)
147 write_long_list(out, indent_level+4, _knots.begin(), _knots.end(),
"",
149 indent(out, indent_level + 2)
152 write_body(out, indent_level+2);
153 indent(out, indent_level) <<
"}\n";
void setup(int order, int num_knots)
Prepares a new curve definition with the indicated order and number of knots.
void write_header(ostream &out, int indent_level, const char *egg_keyword) const
Writes the first line of the egg object, e.g.
CurveType get_curve_type() const
Returns the indicated type of the curve.
int get_num_cvs() const
Returns the total number of control vertices that should* be defined for the curve.
int get_order() const
Returns the order of the curve.
void set_num_knots(int num)
Directly changes the number of knots.
virtual void write(ostream &out, int indent_level) const
Writes the nurbsCurve to the indicated output stream in Egg format.
double get_knot(int k) const
Returns the nth knot value defined.
int get_num_knots() const
Returns the number of knots.
bool is_closed() const
Returns true if the curve appears to be closed.
bool is_valid() const
Returns true if the NURBS parameters are all internally consistent (e.g.
int get_subdiv() const
Returns the requested number of subdivisions, or 0 if no particular subdivisions have been requested...
TypeHandle is the identifier used to differentiate C++ class types.