Game Development Reference
In-Depth Information
4.3.1 Rotation About an Arbitrary Axis
Suppose that we wish to rotate a vector P through an angle θ about an arbitrary
axis whose direction is represented by a unit vector A . We can decompose the
vector P into components that are parallel to A and perpendicular to A as shown
in Figure 4.4. Since the parallel component (the projection of P onto A ) remains
unchanged during the rotation, we can reduce the problem to that of rotating the
perpendicular component of P about A .
Since A is a unit vector, we have the following simplified formula for the
projection of P onto A .
(
)
proj
A PAPA
=⋅
(4.17)
The component of P that is perpendicular to A is then given by
(
)
perp
A PP APA .
=− ⋅
(4.18)
Once we rotate this perpendicular component about A , we will add the constant
parallel component given by Equation (4.17) to arrive at our final answer.
The rotation of the perpendicular component takes place in the plane perpen-
dicular to the axis A . As before, we express the rotated vector as a linear combi-
nation of perp A P and the vector that results from a 90-degree counterclockwise
rotation of perp A P about A . Fortunately, such an expression is easy to find. Let α
A
P
(
)
APA
α
(
)
PAPA
−⋅
Figure 4.4. Rotation about an arbitrary axis.