Graphics Reference
In-Depth Information
we'll see more sophisticated methods for determining whether a face is visible.
For now, give an example of an eyepoint, a shape, and a face of that shape with
the property that (i) the dot product of v and w is negative, and (ii) the face is not
visible from the eye. You may describe the shape informally. Hint: Your object
will have to be nonconvex!
Exercise 3.4: As in the preceding exercise, we can alter a wire-frame drawing
to indicate front and back objects in other ways. We can, for instance, consider
all the lines of the object (the edges of the cube, in our example) and sort them
from back to front. If two line segments do not cross (as seen from the viewpoint)
then we can draw them in either order. If they do cross, we draw the one far-
ther from the eye first. Furthermore, to draw a line segment (in black on a white
background), we first draw a thicker version of the line segment in white, and then
the segment itself in black at ordinary thickness. The result is that nearer lines
“cross over and hide” farther lines.
(a) Draw an example of this on paper, using an eraser to simulate laying down the
wide white strip.
(b) Think about how the lines will appear at their endpoints—will the white strips
cause problems?
(c) Suppose two lines meet at a vertex but not at any other point. Does the order in
which they're drawn matter? This “haloed line” approach to creating wire-frame
images that indicate depth was used in early graphics systems [ARS79], when
drawing filled polygons was slow and expensive, and even later to help show inter-
nal structures of objects.
Exercise 3.5: Create several simple models, such as a triangular prism, a tetra-
hedron, and a 1
×
2
×
3 box, and experiment with them in the rendering program.
For the final two exercises, you may need to read parts of Chapter 4.
Exercise 3.6: Enhance the program by adding a “Load model” button, which
opens a file-loading dialog, lets the user pick a model file, loads that model, and
makes a picture of it.
Exercise 3.7: Implement the suggestion about displaying a rotating cube in
the program. Add a button that, when the cube is loaded, can update the locations
of the cube vertices by computing them with a new value of t , the amount to rotate.
To make the animation look smooth, try changing t by .05 radians per button click.
Search WWH ::




Custom Search