Programming Assignment 4
|
GeneralThe idea is
to extend the previous assignment to
perform knot-insertion. The main
objectives are to gain a better understanding of a knot-insertion
algorithm (you may use any algorithm for this) and to see an example of
subdivision which will make the lecture about subdivision much more
enlightening. |
Your program should accomplish the following:
|
Code
|
Input/OutputAll values in the following descriptions are floating point, unless preceded by int. The input will consist of a file in the following form: (int) Number of Surfaces u step size v step size
first
control point in first row x (int)
Number of control points along each row in second surface first
control point in first row x ...
... ... (int)
Number of control points along each row in last surface first
control point in first row x The output will be a file of triangles in the following form: (int) Number of triangles x00 y00 z00 x01 y01 z01 x02
y02 z02
x11 y11 z11 x12
y12 z12
xn0 yn0 zn0 xn1 yn1 zn1 xn2
yn2 zn2
The
output should be generated by evaluating each surface patch at
parameter values incremented by u step size in u and v step size in v.
The triangles should connect these points. For example a uniform cubic
B-spline surface with four control points in each row and five control
points in each column is defined over parameter values [3,4]x[3,5]. If
the u step size was 0.1 and the v-step size was 0.2, then you would
evaluate the surface at parameter values:
(3.0,3.0)
|
ViewerA viewer with a crystal ball interface
written in C++, using glut and openGL, is provided. It can read in
files of triangles in the format described above. You might simply add
code to it to do your assignment. It is documented.
Download Viewer (9k, tar-zip file) Note you don't have to use this viewer, it is easy to write out your triangles to some other format, vrml for example and use a vrml browser to examine your results (other options like IV, OBJ, STL, etc.) |
What you should hand-inPlease hand in
|