Graphics Reference
In-Depth Information
if string from P to eye-point touches boundary of frame
Do nothing
else
Hold a pencil at point where string passes through frame
Hold string aside
Close shutter to make pencil-mark on paper
Release string
9
10
11
12
13
14
15
Three aspects of this algorithm deserve note, all within the loop that iterates
over all points. First, the iteration is over visible points, so determining visibil-
ity will be important. Second, there may be an infinite number of visible points.
Third, we've said what to do in the event that the string hits the frame rather than
passing through the open area bounded by the frame. This is sure to happen if the
object is so large that only a part of it is visible from the screw eye through the
frame.
We'll discuss the first issue presently; the second is addressed by agreeing to
make an approximate rendering, which we do by selecting only a finite number of
points, but choosing them so that the marks on the paper end up representing the
shape well. The process of choosing a finite number of computations to perform,
in order to best approximate a result that in theory requires an infinite number of
computations, is critical, and will arise in many places in this topic. In this chapter,
we'll render an object that is so simple that we can set this problem aside for the
time being.
The third issue—avoiding drawing points that are outside the view—is also
representative of a common operation in graphics. Generally, the process of
avoiding wasting time on things outside the view region (the part of the world
that the eye or camera can see) is called clipping. Clipping may be as simple
as observing that a point (or a whole object) is outside the view region, or it
may involve more complex operations, like taking a triangle that's partly out-
side the view region and trimming it down until it's a polygon completely inside
the view region. For now, we'll use a very simple version of clipping that's
appropriate for points only—we'll just ignore points that are outside the view
region.
We've made one useful simplification: To determine whether the tip of
the pointer is inside the view region (a 3D volume), we check whether the place
where the string passes through the frame is within the paper area (rather than
the string touching the frame). The two tests are equivalent, but when it comes to
implementing them, doing a point-in-rectangle test is easier than doing a point-in-
3D-volume test.
Inline Exercise 3.1:
Imagine that you can move the lute in Dürer's
woodcut.
a. How could you move it to ensure that “touches boundary of frame” is true
for each iteration of the inner loop, thus resulting in almost all the work of
the algorithm (aside from setup costs) falling into that clause?
b. How would you move it to ensure that no work fell into that clause?
(Your answers should be of the form “Move it closer to the frame and lift it up
a little,” i.e., they should describe motions of the lute within the room.)
 
 
Search WWH ::




Custom Search