CS155

Catmull-Rom splines



In this lab you'll develop code to compute and draw a Catmull-Rom spline. Start by downloading the sample executable catmullRom.exe. When you run the program, you'll find 4 control points and their associated curve. You can move the "current" control point, which is highlighted in white, by using the x,X,y,Y,z, and Z keys. You can change the "current" control point by using the n and N keys. The p key allows you to change the number of control points. The "h" key explains key controls. You can change the camera position using the mouse.

You are going to create your own version of this program. Download the starting code here. Create a new visual studio project then build and run the executable.

You need to complete the drawCurve() function to

  1. Compute the coeffecients of the cubic polynomials X(t), Y(t), and Z(t).
  2. Sample the polynomials in order to draw a line strip that approximates the curve.
After you get 4 control points working, change the number of control points by changing the variable numPoints.