Graphics Programs Reference
In-Depth Information
Next, we calculate the local coordinates of this point on the screen. Vector
c
is
first obtained by
c
=
α
(
p
2
,
2). The local
axes on the screen are computed next from Equation (3.17). They are
u
=(2
,
0
,
0)
and
w
=(0
,
4
,
−
b
)
−
a
=(2
/
5)(0
,
0
,
10)
−
(0
,
2
,
2) = (0
,
−
−
4). We normalize th
e
m by dividing each by its magnitude, obtaining
u
=(1
,
0
,
0) and
w
=(0
,
1
/
√
2
,
1
/
√
2). (Note that
u
is in the
x
direction and
w
is in
−
the
yz
plane.)
T
hu
s, the
sc
reen coordinates of
c
are
u
•
c
=(1
,
0
,
0)
•
(0
,
−
2
,
2) = 0
a
nd
w
•
c
=
(0
,
1
/
√
2
,
−
√
8. The projected point is therefore
√
8 units away
from the center of the screen
C
. Note that this equals the absolute value of vector
c
.
As an added bonus, we compute the plane equation of the screen. Let (
x, y, z
)
be a general point on the screen. The vector from the center (point
C
)to(
x, y, z
)is
(
x
1
/
√
2)
−
•
(0
,
−
2
,
2) =
2). This vector must be perpendicular to the normal to the screen
(vector
a
), which implies
−
0
,y
−
3
,z
−
0=
a
•
(
x, y
−
3
,z
−
2) = (0
,
2
,
2)
•
(
x, y
−
3
,z
−
2)
,
or
y
+
z
=5
.
This equation relates the
y
and
z
coordinates of all the points on the screen. Any point
with coordinates (
x, y,
5
y
) is therefore on the screen regardless of the value of
x
. Note
that the projected point
P
∗
also satisfies this relation.
−
Exercise 3.26:
Generalize the previous example to the case of a general point
P
=
(
x, y, z
).
Example 2
. Again we give a simple example, illustrated in Figure 3
.3
7. The s
cr
een
is centered on the origin at a 45
◦
angle, and the viewer is at point (
k/
√
2), a
distance
o
f
k
units from the screen. To simplify the notation, we introduce the quantity
k/
√
2
,
0
,
−
−
ψ
=
k/
√
2. From Figure 3.36a it is clear that
a
=(
ψ,
0
,ψ
)and
b
=
−
a
=(
−
ψ,
0
,
−
ψ
).
The center of the screen is, as always, at
a
+
b
, which is point (0
,
0
,
0).
x
P
Screen
45
0
z
Viewer
Figure 3.37: Viewer Rotated About the
y
Axis.
Thefirststepistodetermine
α
:
2
2
ψ
2
|
a
|
2
ψ
x
+
z
+2
ψ
.
α
=
b
)
=
(
x
+
ψ, y, z
+
ψ
)
=
a
•
(
P
−
(
ψ,
0
,ψ
)
•
Search WWH ::
Custom Search