Assignment 04 - Parametric Surfaces

Due Date

This assignment is due at 11:59pm on Tuesday, November 6th. Projects turned in late will lose points as described in the policies handout. This assignment should be done alone or in pairs. You may share ideas with other groups, but you may not share code.

Submission Details

You may develop on Unix, OS X, or Windows. The platform you use will be the one used to grade assignments. Keep in mind that there are slight variations due to OS versions, different libraries, and other factors, so you should verify that your code runs on the instructional machines appropriate for you plat form choice.

As with the last assignment, we will be using Prof. Hilfinger's software for submission of this assignment. The submission name is "bezier."

You should include a README file that at the minimum contains the following data:

All files needed to compile your code should appear in the submitted directory. It is your responsibility to make sure that they will compile and run properly. You will also need to set the permissions properly.

Windows: The grader should be able to recompile your program by simply opening the project and rebuilding it from scratch.

Unix and OS X: The grader should be able to recompile your program simply by typing "make".

Check the news group regularly for updates on the assignment or other clarification. We will assume that anything posted there is henceforth known to all.

Overview

For this assignment you will write a program that will convert input from a Bezier surface representation to a polygonal representation and then display it with OpenGL. To do this, your program should:

Your Program

Your program will take two command line arguments with a third option parameter. These are: the input file name, the subdivision parameter, and a flag which determines if subdivision should be adaptive or uniform. An example command would look like:

   % myprogram3 inputfile.bez 0.1 -a 

The input file contains a list of patches. The subdivision parameter should be interpreted as the step size in U and V for uniform subdivision, or as an error measure for adaptive subdivision. If the -a is present, then adaptive subdivision should be used, otherwise uniform.

The Input File

The input file contains the control points for the patches and an output file name. Keep in mind that the control points are vectors, not scalars! An example file would look like arch or teapot.

Conversion and Subdivision

For uniform subdivision, quadrilateral polygons should be formed by taking subdivision parameter sized steps in the U and V direction.

For adaptive subdivision, the error between the actual surface and the quadrilateral polygon should be less than subdivision parameter. The error should be distance evaluated at the midpoints of the quadrilateral edges and the center of each quadrilateral. Techniques to avoid cracking should be used in the adaptive subdivision code. You may prefer to use a subdivision technique that yields triangles. If you do then the error should be checked at the center of each triangle edge.

OBJ Output

The use of OBJ output for this assignment is optional and will be worth some small amount of bonus points. OBJ is a simple 3D surface file format, described here and elsewhere on the web. In it's simplest form, it is just a list of vertices followed by a list of faces (potentially just triangles). If you implement OBJ output then your program should accept an optional command line argument that comes after the required ones. This is -o and a file name. If the -o option is given then no OpenGL window should be opened and instead the model should be written to the specified output file name.

More Optional

If you like, you may use Maya (or some other program) to create additional input files. Maya can be used to create B-Spline surfaces that can be exported to files. Figure out how to get data out of Maya and converted to the format expected by your program.

Questions should be posted to the news group