Project 3: Subdivision Curves and Surfaces
CS354 Computer Graphics
Due: November 4, 11:59pm

Goal
In this project you will implement subdivision curves and subdivision surfaces.

Project Specifications

Four Point Curves: This should be specified by a sequence of control points entered using mouse clicks. On each left click, the current click point should be recorded as control point i, starting at 0.  In a right click, erase the last point that was input by the mouse.  You code only needs to support a maximum of 30 control points.  Be sure to print to stdout the x,y and i values of a control point when it is registered, the i value when a control point is deleted, and warning messages when the user exceeds the bounds of i.

You will be implementing the Four Point Scheme from the first two slides of Lecture 10.  ***NEW*** There should be at least four control points before you perform subdivision, although once there are four control points, your code should refine the user's iteration 0 control points to the current subdivision depth automatically and then draw the result.  The last control point should be connected by an edge to the first control point, forming a closed loop so that all control points are subdivideable.  Draw the user's iteration 0 control points using glBegin(GL_POINTS) in one color, and then, in a different color, draw the lines connecting the fully refined control points using glBegin(GL_LINE_LOOP).***END NEW***

You will add key bindings to increase and decrease the level of subdivision refinement (see Key Bindings Section).  Print a message to stdout displaying the new subdivision level when the user presses the related button to change the value.

Smooth Surfaces: To generate smoothed 3D polyhedron, you should implement the Catmull-Clark Subdivision Scheme covered in class (slides 7 - 10 of Lecture 10). In addition, note that if you have extraordinary vertices in the quadrilateral mesh (a vertex is extraordinary if the number of vertices connected to it is not equal to four) then the given vertex rule does not apply. In this case, instead of weights 1/64, 3/32 and 9/16, use weights:  1/(4n2), 3/(2n2), and 1-[3/(2n)]-[1/(4n)], where n is the number of vertices that the extraordinary is connected to.

Here are the files of simple polyhedra that you will be working with.  Here is a note on the format followed in these files. These polyhedra are very similar to the VRML objects from Project 1.  You should write a simple routine to read in a file in this face-index format for use with your program.  ***NEW*** Draw the fully refined surface either by iterating through the faces of the surface and using  glBegin(GL_POLYGON) with different colors per vertex, or by iterating through the faces and using glBegin(GL_LINE_LOOP) to produce a wireframe.  Use whichever method best demonstrates the subdivision process. ***END NEW***

You will add key bindings to increase and decrease the level of subdivision refinement.  Also, you will add two keys to cycle through the five different polyhedra that you are given (see Key Bindings Section).  Print a message to stdout displaying the new subdivision level or polyhedra name when the user presses the related button to change the value.

Key Bindings: The following list contains all of the key bindings that are required for this assignment.  If you add any additional keys, document your additions in the README file.

• 'd' - toggle between curve and surface display modes (default: curve mode).  If the user switches from curve mode to surface mode and then back to curve mode, the original points in curve mode should still be present.
•
• 'r' - decrease the subdivision refinement level of the curve by 1 (default value of 0). Min value of 0.
• 't' - increase the subdivision refinement level of the curve by 1.
•
• 'f' - decrease the subdivision refinement level of the surface by 1 (default value of 0).  Min value of 0.
• 'g' - increase the subdivision refinement level of the surface by 1.
•
• 'v' - move forward through this list of polyhedra: "cube, unitPyramid, icosahedron, dragon, nface."  The list wraps around (default: cube).
• 'b' - move backward through this list of polyhedra: "cube, unitPyramid, icosahedron, dragon, nface."  The list wraps around.

Getting Started
Here is some starter code that prints the pixel coordinates of where the mouse was clicked ***NEW*** and provides some basic memory management routines for the data in the Four Point Scheme.  To build the project, type "make". ***END NEW***

Written Questions for Each Team Member (20% of the project grade)

1. Give one similarity and one difference between recursive subdivision schemes and fractals in the way they generate objects.

2. What is the limit curve when the Four Point Scheme is applied to a square?  Assume that vertices are spaced out equally on the perimeter of the square and that there are at least 3 vertices on every side of the square (i.e. there can be internal vertices within a side).  What is the limit surface when the Catmull-Clark Subdivision Scheme is applied to a cube?  What can you say happens to sharp corners in general when these two subdivision schemes are applied?

3. Describe how you would design a wide range of smooth 3-D models with holes if all you have are a 2-D sketching system for line segments (like the one from this project), a surface subdivider, and the ability to create surfaces of rotation from 2-D models.  Provide pseudocode.

What and How to Submit
Your program should compile and run on the Taylor or Painter basement machines. Then submit the following files:

• Source code
• Makefile
• project3.jpg
The README file should be a plain text file, it should clearly mention: your name, what the submitted files contain (e.g. which is the executable, which contain the source code etc.), how and on which machine(s) your program compiles and runs, and a short description of the user interface.  In addition, if appropriate, you may also write about what  new ideas you came up with, what design decisions you took etc.; please keep such a  discussion short and to the point.

The project3.txt file should also be a plain text file which should contain the answers to the above "Questions Related to the Project". Each group member needs to create their own version of this file themselves and then submit their own version electronically (see the turnin directions below).

You should grab the image of an interesting subdivision curve you generated and call it project3.jpg. You may do this by using  xv command on Taylor/Painter basement machines. Save it as gif or jpeg file. Here is a note on how to grab a window using xv.

Each group should submit their code using:

turnin --submit djeu cs354_project3_code [source code, Makefile, README, project3.jpg, any additional files]

And each persons in the group should submit their written answers using:

turnin --submit djeu cs354_project3_written project3.txt

Here is a note on how to use the turnin program.

OpenGl Reference book
Neider, Davis and Woo, "OpenGL Programming Guide" Second Edition, Addison-Wesley

Lecture 10 Notes on the CS354 Course Website.