COM 1370 Computer Graphics - Summer 2001 - Assignment 5
Professor Futrelle -- College of Computer Science, Northeastern U., Boston, MA
ASSIGNMENT DUE END OF MONDAY August 13th
Updated Sunday 8/5/2001
This assignment is due electronically by the end of the day (midnight)
Monday 8/13.
Remember, turn in whatever you have done by that time.
Overview
This is a now a three-part project. This is part 2.
This part will involves rotation of
a polyhedron in three dimensions.
The third part, due Thursday, August 23rd, the last day of classes,
will deal with illumination
of the polyhedron from two light sources. That will be the last
assignment of the quarter.
Do the following for a basic C grade.
(An excellent job on this part could get you more than a C, e.g.,
a clean and clear and well-organized and commented system.)
This assignment should not be particularly hard, since it primarily consists
of organizing some polygons in relation to one another.
You have already learned how to transform and fill polygons and handle
backface orientation in the previous assignments.
-
Create a Polyhedron class that contains a set of
points (as an array or some type of collection such as a Vector),
as well as a set of Polygon objects describing the faces.
-
Design a specific polyhedron. You could write a constructor for it
or some other procedure that returns a polyhedron instance (a "factory").
In class, I suggested one example, a pyramid with corners 0,200,0 and
100,0,0 and -100,0,0 and 0,0,100 and 0,0,-100. Note the important design
strategy here: The points are shared among the polygons. So even
though this example has four faces with three points and one with four,
together they reference only five distinct points.
-
In each Polygon object store a vector that is initially normal to the
surface you create.
Calculating normal vectors can be done using Eq. 10-4 on page 308.
This will need to be transformed in the same
way the points are in order for you to know its orientation so you
can do back-face detection. In the next assignment you'll need to
use this normal vector to compute lighting effects.
You can either transform both ends of each normal vector (initially, one
end is at the origin) or create a version of your transform that does
no translation.
-
Transform your points and normal vectors and draw (fill) the corresponding polygons so
that the polyhedron tumbles in space. Skip drawing any polygon whose
transformed normal vector points away from the viewer (z-component < 0).
-
You'll need to make each face a different color so the viewer can
distinguish them.
For a higher (B) grade: Use double buffering to avoid flicker.
Start with the
Dori Smith example
and use google to find other double-buffering examples
(also called off-screen drawing).
For the highest (A) grade: Use mouse interaction to allow the user to
rotate the polyhedron in two axes. E.g., Mouse x rotates around y and mouse y
rotates around x, with no z rotation. See the Dori Smith
mouse tracking example
and use Google to find other examples if you need to. You are not required to
double-buffer this example, but it would certainly help it and help
assure your A.
See the page on electronic handins for the correct way to set up your
directories and files for your electronic handins.
Go to COM1370 home page
Return to Prof. Futrelle's home page