Game Development Reference
In-Depth Information
reflection
shearing
Chapter 5 derives matrices that perform all of these operations. For
now, though, let's just attempt a general understanding of the relationship
between a matrix and the transformation it represents.
The quotation at the beginning of this chapter is not only a line from a
great movie, it's true for linear algebra matrices as well. Until you develop
an ability to visualize a matrix, it will just be nine numbers in a box. We
have stated that a matrix represents a coordinate space transformation.
So when we visualize the matrix, we are visualizing the transformation, the
new coordinate system. But what does this transformation look like? What
is the relationship between a particular 3D transformation (i.e. rotation,
shearing, etc.) and those nine numbers inside a 3 × 3 matrix? How can we
construct a matrix to perform a given transform (other than just copying
the equations blindly out of a book)?
To begin to answer this question, let's watch what happens when the
standard basis vectors i = [1,0,0], j = [0,1,0], and k = [0,0,1] are multi-
plied by an arbitrary matrix M :
2
3
m 11 m 12 m 13
m 21 m 22 m 23
m 31 m 32 m 33
4
5
iM =
1
0
0
=
m 11 m 12 m 13
;
2
3
m 11 m 12 m 13
m 21 m 22 m 23
m 31 m 32 m 33
4
5
jM =
0
1
0
=
m 21 m 22 m 23
;
2
3
m 11 m 12 m 13
m 21 m 22 m 23
m 31 m 32 m 33
4
5
0
0
1
m 31 m 32 m 33
kM =
=
.
In other words, the first row of M contains the result of performing the
transformation on i , the second row is the result of transforming j , and the
last row is the result of transforming k .
Once we know what happens to those basis vectors, we know everything
about the transformation! This is because any vector can be written as a
linear combination of the standard basis, as
v = v x i + v y j + v z k .
Search WWH ::




Custom Search