Game Development Reference
In-Depth Information
vectors p , q , and r into the matrix in Equation (8.1) and expand the dot
products, we get
2
3
2
3
2
4 p
3
p
x p
y p
z
[1,0,0] p
[0,1,0] p
[0,0,1] p
4
5
4
5
5
z
[1,0,0] q
[0,1,0] q
[0,0,1] q
=
q
x q
y q
=
q
.
r
x
r
y
r
z
[1,0,0] r
[0,1,0] r
[0,0,1] r
r
In other words, the rows of the rotation matrix are the basis vectors of the
output coordinate space, expressed by using the coordinates of the input
coordinate space. Of course, this fact is not just true for rotation matrices,
it's true for all transformation matrices. This is the central idea of why a
transformation matrix works, which was developed in Section 4.2.
Now let's look at the other case. Instead of using coordinates relative
to the first basis, we'll measure everything using the second coordinate
space (the output space). This time, p
have trivial forms, and
p , q , and r are arbitrary. Putting these into the direction cosines matrix
produces
2
, q
, and r
3
2
3
2
4 |
3
p [1,0,0] q [1,0,0] r [1,0,0]
p [0,1,0] q [0,1,0] r [0,1,0]
p [0,0,1] q [0,0,1] r [0,0,1]
p x q x r x
p y q y r y
p z q z r z
|
|
4
5
4
5
5
p T
q T
r T
=
=
.
|
|
|
This says that the columns of the rotation matrix are formed from the basis
vectors of the input space, expressed using the coordinates of the output
space. This is not true of transformation matrices in general; it applies
only to orthogonal matrices such as rotation matrices.
Also, remember that our convention is to use row vectors on the left. If
you are using column vectors on the right, things will be transposed.
8.2.3 Advantages of Matrix Form
Matrix form is a very explicit form of representing orientation. This explicit
nature provides some benefits.
Rotation of vectors is immediately available. The most important
property of matrix form is that you can use a matrix to rotate vec-
tors between object and upright space. No other representation of
orientation allows this 4 —to rotate vectors, we must convert the ori-
entation to matrix form.
4 It is an often-touted advantage of quaternions that they can be used to perform
rotations through quaternion multiplication (see Section 8.5.7) . However, if we examine
the math, we see that this “shortcut” amounts to multiplication by the corresponding
rotation matrix.
Search WWH ::




Custom Search