CS536 - Homework Assignment 3
Bi-cubic Bezier Patch

Programming Problem:

Write a program, named CG_hw3, that evaluates a 3D bi-cubic Bezier patch and approximates it with triangles.
The patch's u and v parameters will be incremented by du and dv during evaluation.
The patch's definition is

CG_hw3 has the following specification:

1. The program reads in the patch's 3D control points from a file specified by the -f filename argument. The file will contain 16 3D points, one per line (3 floating point numbers), for example:
x1 y1 z1
x2 y2 z2
x3 y3 z3
x4 y4 z4
...
Default value: patchPoints.txt
2. The i-j ordering of control points: [0,0], [1,0], [2,0], [3,0], [0,1], [1,1], [2,1], etc.
3. The u increment du is determined by the -u num_u argument. num_u is a positive integer which defines the number of point samples of the u parameter. Default value: 11. du = 1/(num_u - 1)
4. The v increment dv is determined by the -v num_v argument. num_v is a positive integer which defines the number of point samples of the v parameter. Default value: 11. dv = 1/(num_v - 1)
5. The locations of the control points should be displayed with small spheres.
6. The radius of the spheres is specified by the -r radius argument. Default value: 0.1
7. The argument -F tells your program to output a flat-shaded (no normals) triangle mesh.
8. The argument -S tells your program to output a smooth-shaded (with normals) triangle mesh.
You should compute the exact normals and not an approximation derived from the mesh.
If neither the -F or the -S argument is given, a flat-shaded mesh is written to the output.
9. In your README file, list the filename and line numbers of the code that implements your surface normal calculations.
10. Be sure to evaluate the parameter values only in the range 0 ≤ u ≤ 1, and to include the four corner points.
11. Write the resulting graphics primitives in the Open Inventor format to standard out.
12. Your program will be tested with the command "./CG_hw3 -f filename > out.iv"
13. Your program should not require arguments and should be able to process a subset of them in arbitrary order.

### Link to Example Control Points File

num_u = num_v = 9

### Link to Inventor file of a flat-shaded tessellated patch, so you can see what yours should look like

num_u = 15     num_v = 9

### Link to Another Example Control Points File

num_u = num_v = 13

### Link to Inventor file of a flat-shaded tessellated patch, so you can see what yours should look like

1. Parsing input file correctly : 1 point
2. Display control points with spheres correctly: 1 point
3. Incrementing parameter values correctly : 1 point
4. Bezier patch evaluation correct : 5 points
5. Correctly implementing normals and flat/smooth-shading: 2 points

4. Submission Guidelines:

1. Assignments must be submitted via Bb Learn.
2. Makefile whose default action is to create the executable, or include a script with the appropriate name.
3. README file: explain the features of your program, language and OS used, compiler or interpreter used, name of file containing main(). Text files only. Word and PDF documents will NOT be accepted.
4. All source code. Your code must compile and run on tux (Linux).
5. You may program in any language you like as long it can produce a usable executable on tux.
6. Your program will be run by the TA. Please do NOT submit any image files, Visual C++ project files, or anything not requested in this section. Your program must run on tux without the installation of "special" libraries.
7. If you are using a language that doesn't produce an executable file, e.g. python, then be sure to include a script called CG_hw3 that accepts arguments and prints Inventor to standard out.
8. Points will be deducted if submission guidelines are not followed.

NOTE: Your source code for all programming assignments will be run through a plagiarism detection system. This program uses compiler techniques which are invariant of syntax and style. If you are sharing code with other classmates, you will get caught. Please refer to the student handbook for actions that will be taken.