Math 155B - Introduction to Computer Graphics - Winter 2005

Project #1 - Catmull-Rom and Overhauser interpolating splines

Overview:  For this assignment you will write a program that accepts points via the mouse, and draws a spline curve which interpolates them.  Your program will generate two kinds of curves: Catmull-Rom curves and Overhauser curves. 

Due date: Wednesday, January 19, midnight.

Your program should support the following:

  1. Left mouse clicks place points in the window.  The curve is updated on the screen interactively with mouse clicks.
  2. The curve interpolates all the points, including the first and last points.   This was not true of the Catmull-Rom and Overhauser splines as defined in class.  You may implement this is several ways, for instance by acting as if the first and last point are placed twice or by setting the first derivative is zero at the beginning and end of the curve.
  3. The c command ("c" for "curve") toggles between Catmull Rom and Overhauser curves.
  4. The f command removes the first point on the curve.  The l command removes the last point on the curve ("f" for "first" and "l" for "last").  If more than 64 points are placed, then the first point is removed.
  5. Extra credit (small amount): Implement also curves with centripetal parameterization of the knot values.

I have written a skeletal version of the program.  The source code is available from the textbook's web page, or directly from   This program supports catching mouse clicks, the f and l commands, and clamping to at most 64 points.  It draws only straight-line segments, not curves:  your job is to add to the program the ability to draw interpolating curves. 
    The sample program has been written to draw big, black points and thick, colored lines and curves.  Whether this works on any particular machine is implementation dependent (a few years ago, I tried this program on four different machines, with as many different results.)  

A sample PC executable is available as CatmullRomDraw.exe.

Helpful hints:

  1. Start with the provided sample code.
  2. For each segment of the interpolating spline, draw it with a one dimensional Bezier curves (with glMap1f, glMapGrid1f, etc).   Use the GL_MAP1_VERTEX_3 version (setting z-coordinates to zero).
  3. Watch out for repeated points, so you do not get a divide-by-zero exception in this case.  Handle repeated points as you think best.
  4. If you have problems with dropped pixels in thick lines, this is an OpenGL implementation bug, and is not your fault.

Hand in procedure:    Create a directory called Project1 in your CSE167/Math155B "storage" directory on the PC computers.   (Your ieng9 course home directory.)  Place there your source files and your Visual C++ solution and project files.  Do not modify these after turning in the programs, so as to leave the file dates unmodified.    Your program should compile and run in your work directory with the version of Visual C++ that is installed on the computer lab computers.   If you use another version of C++ at home for development it is your responsible to convert your project files to work on the computer lab computers.

Grading:  Grading is an individual session with Jefferson Ng or Professor Buss.  Please do not modify your files after the due date.  You should be prepared to explain how your program works, and to show examples of the relative advantages and disadvantages of the Catmull-Rom splines and the Overhauser splines.