Game Development Reference
In-Depth Information
1000
0100
0011
0000
p
p ' , for p 3 0
ppp
,
,
,
1
ppp
,
,
,
p 3
1
2
3
1
2
3
and p 3 1.
We note that w = p 3 . When w 0 and w 1, we say that we have a vec-
tor in homogeneous space , as opposed to a vector in 3-space. We can map
a vector in homogeneous space back to three dimensions by dividing
each component of the vector by the w component. For example, to
map the vector ( x, y, z, w ) in homogeneous space to the 3D vector x
we would write:
xy zw xy z xy z x
wwww www www
,
,
,
,
,
, 1 ,
,
Going to homogeneous space and then mapping back to 3D space is
used to do perspective projections in 3D graphics programming.
Note: When we write a point ( x, y, z )as( x, y, z, 1) we are techni-
cally describing our 3D space on a 4D plane in 4-space, namely the
4D plane w = 1. (Note that a plane in 4D is a 3D space, just like a
plane in 3D is a 2D space.) Thus, when we set w to something else, we
move off the w = 1 plane. In order to get back onto that plane, which
corresponds with our 3D space, we project back onto it by dividing
each component by w .
The Translation Matrix
Figure 8: Trans-
lating 12 units on
the x-axis and -10
units on the y-axis
We can translate the vector ( x, y, z, 1) p x units
on the x-axis, p y units on the y-axis, and p z
units on the z-axis by multiplying it with the
following matrix:
1
0
0
0
0
1
0
0
T
p
0
0
1
0
p
p
p
1
x
y
z
Search WWH ::




Custom Search