A fair amount of 3D geometry is involved in automatically setting up the camera. (Even more is involved in using the mouse to drag the camera to a different viewpoint, but we will defer that for now.) We also need to understand some geometry of vectors to do the computations for material and lighting.
So, we're going to attack that now. The following PDF file explains the relevant math. The most important part of the following is understanding the dot product. The dot product is used in several ways in the lighting model, so the more comfortable you are with it, the better. We won't use cross-products in material and lighting, but we will later in the semester, and it fits reasonably well here, but if you get lost in understanding the cross-product, don't worry.
vector math (pdf)
We implemented two demos to help visualize the geometry in the vector math document. demos/camera/VectorFun2D.cc and demos/camera/VectorFun3D.cc.
What kind of interface would you invent to draw in 3D?
Written by Scott D. Anderson
scott.anderson@acm.org

This work is licensed under a Creative Commons
License.