When an object is to be rotated about an axis that is not parallel to one of the coordinate axes, we need to perform some additional transformations. In this case, we also need rotations to align the axis with a selected coordinate axis and to bring the axis back to its original orientation. Given the specifications for the rotation axis and the rotation angle, we can accomplish the required rotation in five steps.
- Translate the object so that the rotation axis passes through the coordinate origin.
- Rotate the object so that the axis of rotation coincides with one of the coordinate axes.
- Perform the specified rotation about that coordinate axis.
- Apply inverse rotations to bring the rotation axis back to its original orientation.
- Apply the inverse translation to bring the rotation axis back to its original position.