ts::BSpline& ts::BSpline::operator=(const ts::BSpline& other) { if (&other != this) { const tsError err = ts_bspline_copy(&other.bspline, &bspline); if (err < 0) throw std::runtime_error(ts_enum_str(err)); } return *this; }
void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); tsBSpline draw; if (drawBeziers) ts_bspline_to_beziers(&spline, &draw); else ts_bspline_copy(&spline, &draw); glColor3f(1.0, 1.0, 1.0); glLineWidth(3); gluBeginCurve(theNurb); gluNurbsCurve( theNurb, draw.n_knots, draw.knots, draw.dim, draw.ctrlp, draw.order, GL_MAP1_VERTEX_3 ); gluEndCurve(theNurb); ts_bspline_free(&draw); // draw control points glColor3f(1.0, 0.0, 0.0); glPointSize(5.0); size_t i; glBegin(GL_POINTS); for (i = 0; i < spline.n_ctrlp; i++) glVertex3fv(&spline.ctrlp[i * spline.dim]); glEnd(); glutSwapBuffers(); glutPostRedisplay(); }
ts::BSpline::BSpline(const ts::BSpline& other) { const tsError err = ts_bspline_copy(&other.bspline, &bspline); if (err < 0) throw std::runtime_error(ts_enum_str(err)); }