Graphics Programs Reference
In-Depth Information
Before we continue with the analysis, the following cases should be discussed:
1. α is positive. This is the normal case. It means that the viewer and point P are
on different sides of the screen and the projection is meaningful.
2. α is zero. This implies a vector a of magnitude zero (i.e., a viewer positioned
at the screen). Either the viewer or the screen should be moved before anything can be
meaningfully displayed.
3. α is negative. This implies that P and the viewer are on the same side of the
screen, so P should not be projected.
4. α is undefined. This occurs when a
b ) = 0, implying that a is perpendicular
to p b and therefore to e . Vector e is therefore parallel to the screen, making it
impossible to project P .
After α is computed and checked, we can proceed in one of two ways: (1) We can
use Equation (3.15) to calculate vector d , which points directly to P on the screen, or
(2) we can calculate the screen coordinates of vector c . In the latter case, we consider
the center of the screen (point C ) a local origin and we define two unit vectors u and
w to serve as local axes on the screen. The screen coordinates of c are, in this case, the
projections u c and w c of c on these axes.
In order to compute u and w , we recall that they should be on the screen (and
therefore perpendicular to a ) and also perpendicular to each other. We can therefore
write a
( p
w = 0. It also makes sense to require that u be in the xy
plane (which will cause w to point in the z direction as much as possible). Solving these
equations results in
u = a
w = u
a x
a y ) .
u =( a y ,
a x , 0)
and
w =( a x a z ,a y a z ,
(3.17)
Vectors u and w should then be normalized.
Note that u and w are undefined if a points in the z direction [if a =(0 , 0 ,a z ), then
u = w =(0 , 0 , 0), an undefined direction]. However, in this case the screen is parallel
to the xy plane, so we can simply define the local coordinate axes as u =(1 , 0 , 0) = i
and w =(0 , 1 , 0) = j .
This novel approach to general perspective is illustrated by two examples.
Example 1 . This is a simple example (Figure 3.36b) where all the points lie on
the yz plane.
We assume a viewer at B =(0 , 1 , 0), looking in direction (0 , 1 , 1) (i.e., 45 in the
yz plane). Vector a must point in this directi on, and we a ssume a =(0 , 2 , 2) (i.e., the
center of the screen is at a distance of
= 2 2 +2 2 = 8 units from the viewer). We
further assume that the point P to be projected is at (0 , 1 , 10). The center of the screen
(point C ) is easily seen to be at b + a =(0 , 1 , 0) + (0 , 2 , 2) = (0 , 3 , 2). The first step is
to determine α
|
a
|
2
| a |
8
0) = 2
α =
b ) =
5 .
a
( p
(0 , 2 , 2)
(0
0 , 1
1 , 10
Thenextstepistocompute d = b + α ( p b )=(0 , 1 , 0) + (2 / 5)(0 , 0 , 10) = (0 , 1 , 4).
The projected point P is therefore at (0 , 1 , 4). (See the diagram to convince yourself
that the precise value of the z coordinate of P is irrelevant in this case.)
Search WWH ::




Custom Search