Game Development Reference
as affected by the previous rotation before they can be correctly applied. In other words,
you have to rotate R 2 by R 1 to get a new R 2 before applying it. All this happens to work
out in such a way that you reverse the order of multiplication of rotation matrices when
they are defined in a rotating coordinate system.
Figure 11-1 shows a right-handed coordinate system that illustrates the directions of
positive rotation about each coordinate axis.
Figure 11-1. Right-handed coordinate system
Let's consider rotation around the z-axis where the point shown in Figure 11-2 is rotated
through an angle θ.
Figure 11-2. Rotation around the z-axis
The coordinates of the point before the rotation are ( x , y , z ) and after the rotation the
coordinates are ( x r , y r , z r ). The rotated coordinates are related to the original coordinates
and the rotation angle by the following:
x r = x cos θ − y sin θ
y r = x sin θ + y cos θ
z r = z