
Chapter
17
Rotations
R
otation of vectors is a common operation in computer graphics. Most pro-
grammers are comfortable with rotation matrices. A few are uncomfortable
with the quaternions, an alternate representation for rotation matrices, because of
their inherent mathematical nature. This chapter summarizes both topics, but in the
end the emphasis is on the comparison of rotation matrices and quaternions regard-
ing memory usage and computational speed.
17.1
Rotation Matrices
A 2D rotation of the vector (x, y) to the vector (x
, y
) by an angle θ is represented
by the matrix
x
y
=
cos θ − sin θ
sin θ cos θ
x
y
= R
2
x
y
(17.1)
where the last equality