Graphics Reference
In-Depth Information
(
x
c
,
y
c
,
z
c
)
X
P
X
c
x
P
y
P
Z
c
X
c
X
p
Fig. 7.31.
The axial systems used to produce a perspective projection.
which will be used to capture a perspective projection of an object. Figure
7.31 shows that any point (
x
c
,y
c
,z
c
) becomes transformed to (
x
s
,y
s
,d
). It
also shows that the screen's
x
-axis is pointing in the opposite direction to the
camera's
x
-axis, which can be compensated for by reversing the sign of
x
s
when it is computed.
Figure 7.32 shows plan and side views of the scenario depicted in Fig-
ure 7.31, which enables us to inspect the geometry and make the following
observations:
x
z
=
−
x
p
d
d
x
z
x
p
=
−
y
z/d
x
p
=
−
y
z
=
y
p
d
y
p
=
d
y
z
y
z/d
y
p
=
(7.124)
This can be expressed in matrix as
⎡
⎤
⎡
⎤
⎡
⎤
x
s
y
s
z
s
W
−
10 0 0
01 0 0
00 1 0
00
/d
x
y
z
1
⎣
⎦
⎣
⎦
·
⎣
⎦
=
0
At first this may seem strange, but if we multiply it out we get
[
x
p
y
p
z
p
W
]
T
xyzz/d
]
T
=[
−
and if we remember the idea behind homogeneous coordinates, we must divide
the terms
x
p
,y
p
,z
p
by
W
to get the scaled terms, which produces
x
p
=
−
x
z/d
,
y
z/d
,
z
z/d
=
d
p
=
p
=