Math 155B – Topics in Computer Graphics – Spring 2018
 

Project #1 - Catmull-Rom, Overhauser, and Centripetal interpolating splines

Overview:  For this assignment, you will write a program that accepts points via mouse clicks, and draws a spline curve that interpolates them.  Your program will generate three kinds of curves: Catmull-Rom curves and Overhauser curves with chord length parameterization and with centripetal parameterization.. 

Due date: Friday, April 13, 9:00pm.

Download a sample executable, and starter code from:

http://www.math.ucsd.edu/~sbuss/CourseWeb/Math155B_2018Spring/Project1/ConnectDotsDemo_Spring2018.zip

Your program should support the following: (Test them out with the executable downloaded in the zip file above).

  1. The left mouse button is used to 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 in several ways.  The most likely ways are either: (a) by acting as if the first and last point are placed twice or (b) by setting the first derivative to zero at the beginning and the end of the curve. (The “Demo” program uses the first option, but the second option is perhaps better.  Either way is OK for your programming assignment.)
  3. The 0 command shows straight-line interpolation;
  4. The 1 command selects Catmull Rom curves (unit length parameterization);
  5. The 2 command selects Overhauser curves with chord length parameterization;
  6. The 3 command selects Overhauser curves with centripetal parameterization.
  7. The f (F) command removes the first point on the curve.  The l (L) command removes the last point on the curve ("f" for "first" and "l" for "last").  If more than 100 points are placed, then the first point is removed when a new point is added to the end.
  8. (Optional.) The command c (C) (for “control polygon”) toggles drawing of the control polygon. This is not a required element of the programming assignment, but it is recommended to implement it to help with debugging.
  9. (Less important.) Selecting a point by right clicking with the mouse, and holding the mouse button down, allows you to drag an interpolation point to a new position.  If you finish the rest of the assignment, and want to do more, you can implement this as well. This is worth only 2 points of the total 20 points possible.

A skeletal version of the program is available in the zip file given above, as well as online from http://math.ucsd.edu/~sbuss/MathCG2/OpenGLsoft/ConnectDotsModern.   This program supports catching mouse clicks, the and l commands, and clamping to at most 100 points.  It draws only straight-line segments, not curves:  your main job is to add to the program the ability to draw interpolating curves (Catmull-Rom and two kinds of Overhauser splines).  
    The sample program draws big, black points and thick, colored lines and curves.   

A “Demo” sample PC executable is available as CatmullRomDemo.exe, along with its full source code. To avoid virus blockers, you can download the executable via the following zip file:

http://www.math.ucsd.edu/~sbuss/CourseWeb/Math155B_2018Spring/Project1/ConnectDotsDemo_Spring2018.zip

Helpful hints:

  1. Start with the provided sample code.
  2. For each segment of the curve, compute the Bezier curve control points for that segment.  This will give you a total of 3*(NumDots-1)+1 many points.  Store these in a separate VAO/VBO.
  3. Then, for each segment of the curve, calculate sufficiently many points on the curve, store them into an array, and load them into a VBO.  (You will need a separate VAO and VBO for drawing the curve as a sequence of short line segments.  Introduce a parameter (suggestion: call it “MeshRes”) for the number of straight-line segments used to approximate each Bezier curve; experiment to find out what values work well (say between 20 and 40).
  4. Watch out for repeated points (obtained by clicking the same point twice in a row), so you do not get a divide-by-zero exception.  Handle repeated points as you think best. Be prepared to explain how you handled this.

Hand in procedure:   FIRST: As usual, create a directory called Project1 or something similar in your networked file system on the PC computers. (Not the desktop).  Place there your source files and your Visual C++ solution and project files.  Your program should compile and run in your work directory with the version of Visual C++ installed on the computer lab computers.   If you use another version of C++ at home for development, it is your responsibility to convert your project files to work on the computer lab computers.

SECOND: Upload your primary source file (.cpp file) to gradescope. If you made other new source files, upload those also at the same time.

Grading:  Grading is an individual session with Jonathan Conder 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 two types of Overhauser splines.