Example #1
0
ts::BSpline& ts::BSpline::operator=(ts::BSpline&& other)
{
    if (&other != this) {
        ts_bspline_free(&bspline);
        swap(other);
    }
    return *this;
}
Example #2
0
void move_test_bspline_different_ptr(CuTest* tc)
{
	tsBSpline spline, moved;

	ts_bspline_new(6, 3, 3, TS_OPENED, &spline, NULL);
	CuAssertPtrNotNull(tc, spline.pImpl);
	moved.pImpl = NULL;

	ts_bspline_move(&spline, &moved);
	CuAssertPtrEquals(tc, spline.pImpl, NULL);
	CuAssertPtrNotNull(tc, moved.pImpl);

	ts_bspline_free(&moved);
}
Example #3
0
void display(void)
{
	size_t i;
	tsBSpline buckled;
	tsReal *ctrlp, *knots;

	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	ts_bspline_buckle(&spline, b, &buckled, NULL);

	/* draw buckled */
	ts_bspline_control_points(&buckled, &ctrlp, NULL);
	ts_bspline_knots(&buckled, &knots, NULL);
	glColor3f(1.0, 1.0, 1.0);
	glLineWidth(3);
	gluBeginCurve(theNurb);
		gluNurbsCurve(
			theNurb, 
			(GLint)ts_bspline_num_knots(&buckled),
			knots,
			(GLint)ts_bspline_dimension(&buckled),
			ctrlp,
			(GLint)ts_bspline_order(&buckled),
			GL_MAP1_VERTEX_3
		);
	gluEndCurve(theNurb);

	/* draw control points */
	glColor3f(1.0, 0.0, 0.0);
	glPointSize(5.0);
	glBegin(GL_POINTS);
	  for (i = 0; i < ts_bspline_num_control_points(&buckled); i++)
		 glVertex3fv(&ctrlp[i * ts_bspline_dimension(&buckled)]);
	glEnd();

	ts_bspline_free(&buckled);
	free(ctrlp);
	free(knots);

	b -= 0.001f;
	if (b < 0.f)
		b = 1.f;

	glutSwapBuffers();
	glutPostRedisplay();
}
Example #4
0
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();
}
Example #5
0
void tear_down()
{
	ts_bspline_free(&spline);
}
Example #6
0
ts::BSpline::~BSpline()
{
    ts_bspline_free(&bspline);
}
Example #7
0
void tear_down()
{
	ts_bspline_free(&spline);
	free(ctrlp);
	free(knots);
}