Graphics Reference
In-Depth Information
increasing x will point to our left . (The direction of increasing y will still point
up, as expected.) We could choose to plot our points on a piece of graph paper in
which we decide that x increases to the left, or we can flip the sign on x to make
it increase to the right. We'll do the latter, because it's consistent with the more
general approach we'll take later. So we revise the last part of our algorithm to the
code shown in Listing 3.3.
Listing 3.3: Minor alteration to the Dürer rendering algorithm.
1
2
if x min ( x / z ) x max and y min ( y / z ) y max
make a point on the drawing at location (- x / z , y / z )
To complete our modern-day implementation, we need (1) a scene, (2) a model
of the objects in the scene, and (3) a method for drawing things.
For simplicity, our scene will consist of a single cube. Our model of the cube
will initially consist of a set containing the cube's eight vertices. A basic cube can
be described by the following table:
Index
Coordinates
0
(
0.5,
0.5,
0.5)
1
(
0.5,
0.5,
0.5)
2
( 0.5,
0.5,
0.5)
3
( 0.5,
0.5,
0.5)
4
(
0.5,
0.5,
0.5)
5
(
0.5,
0.5,
0.5)
6
( 0.5,
0.5,
0.5)
0.5, 0.5)
Unfortunately, this cube is centered on the eyepoint, rather than being out in
the area of interest, beyond the frame. By adding 3 to each z -coordinate, we get a
cube in a more reasonable location:
7
( 0.5,
Index
Coordinates
0
(
0.5,
0.5, 2.5)
1
(
0.5,
0.5, 2.5)
2
( 0.5,
0.5, 2.5)
3
( 0.5,
0.5, 2.5)
4
(
0.5,
0.5, 3.5)
5
(
0.5,
0.5, 3.5)
6
( 0.5,
0.5, 3.5)
7
( 0.5,
0.5, 3.5)
3.3.1 Drawing
The vertices of a cube are indeed interesting points, but we should draw points
from all over the surface of the cube to really mimic Dürer's drawing. On closer
inspection, however, we see that the points selected by the two apprentices lie on
what we could call “important lines” like the outline of the lute, or sharp edges
between pairs of surfaces. 3 For the cube, these important lines consist of all the
points on the edges of the cube. Drawing all these points (or even a large number
3. The question of which lines in a scene are important is of considerable interest in
nonphotorealistic or expressive rendering, as discussed in Chapter 34.
 
 
 
Search WWH ::




Custom Search