Due date: Thursday, March 31.
In this surface we'll be generating rotation surfaces together with the normals and render them using material properties and a light source.
Ex. 1 Download the following files in a separate folder than
the previous homework.
point3f.h
point3f.cc
interface.h
interface.cc
main.cc
surface.cc
surface.h
trackball.h
trackball.cc
Makefile
Compile the program with the command make and run it with the command "surf". For now this program draws a circle and a torus with some material effects.
a. Implement the function compute_normals_xy in surface.cc. This function must compute the normals for a curve in the xy plane. You can use the function orthogonal_xy from the Point3f class (see the reference). In addition to calling this function for each individual segment (made of two points in the sequence), for each 2 adjacent line segments, the normal should be the average of the two normals computed on each segment. If the first and last point are the same, then the normal in the first and last points should be averaged between the first and the last segment.
b. Implement the function rotation_surface_y which is given a curve with normals in the xy plane and builds a rotation surface by rotating this curve around the Oy axis. If the curve is defined by (x1(s), y1(s)), then the surface is defined by
x(s, t) = x1(s) cos t
y(s, t) = y1(s)
z(s, t) = x1(s) sin t
The normals are computed by applying the same rotation to the corresponding normal vector to the curve in the given point (x1(s), y1(s)).
c. Implement the function draw_surface that must draw the surface given as a grid of points as a sequence of triangle strips (see class notes). You must also use the normals in this function so that the surface looks smooth.
2. Replace the circle and glut torus in the display (look at the create_display_list function in interface.cc) with at least two objects created as the rotation surfaces, one of which must be a torus, and the other something else (whatever you want).
Add another material function with a different color and shininess, and apply different material properties to the two objects.
Send me: all the files that you modified/added. For more than 5 files you can send me an archive (tar.gz or zip) of the files.