Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

29 lines (23 sloc) 0.843 kb
void s (string basis, float y, float knots[])
float x;
x = splineinverse (basis, y, knots);
printf ("splineinverse(\"%s\", %g) = %g (derivs %g %g)\n",
basis, y, x, Dx(x), Dy(x));
float y2 = spline (basis, x, knots);
printf ("spline(\"%s\",%g) = %g (derivs %g %g)\n",
basis, x, y, Dx(y), Dy(y));
if (fabs(y-y2) > 0.0001)
printf ("ERR! splineinverse doesn't appear to work\n");
printf (" spline(\"%s\",%g) = %g\n", basis, 0.0, spline(basis,0.0,knots));
printf (" spline(\"%s\",%g) = %g\n", basis, 1.0, spline(basis,1.0,knots));
printf ("\n");
shader test ()
float knots[7] = { 0, 0, 0.05, 0.1, 0.3, 1, 1 };
printf ("u = %g (derivs %g %g)\n", u, Dx(u), Dy(u));
s ("linear", u, knots);
s ("catmull-rom", u, knots);
s ("bspline", u, knots);
Jump to Line
Something went wrong with that request. Please try again.