Comp 236, Assignment 2
This applet allows you to interactively fly through a set of triangles.
Use these keys (some have more than one alternative):
Movement |
Key |
Forward | Up arrow, 8 |
Backward | Down arrow, 2 |
Turn left | Left arrow, 4 |
Turn right | Right arrow, 6 |
Pitch down (Dive!) | W |
Pitch up (Pull up!) | S |
Roll left | A |
Roll right | D |
Slide left | Q, 7 |
Slide right | E, 9 |
Last movement again | Mouse click |
NOTE: You may have to click once on the applet panel before the keys will work.
(This tells Netscape to send the keys to the applet).
New Features:
- Hey, color interpolated triangles. It looks really good in 16 or 24 bit color.
- New movement. Slide left and right is like the sidestep in Doom. Check out
the chart above for the new keys which are available to move yourself around.
- Visibility is handled with backface culling. I compute the normal of each triangle
in the cannonical cube, and only display it if the normal's z-component is positive
(i.e. it points at me).
Fixed Bugs:
- I found a bug in my computation of the perspective projection matrix, and fixed it.
Known Bugs:
- I saw a 1 pixel gap between two triangle whose common side was verticle. I
believe it has something to do with numerical error, but I don't know what to do about it.
Source Code:
Here's a browsable directory.
Some of this code was borrowed from Leonard McMillan's code, which he has made available as
part of assignments for Comp 136. Part of the code was also adapted from example applets
provided by Sun with their JDK.
Our textbook explains all of the 3D techniques we are using in these assignments:
Foley, van Dam, Feiner, Hughes. Computer Graphics: Principles and Practice, 2nd Ed. in C,
Addison-Wesley, 1996.
Last modified: Feb 10, 1997. Aron Helser