There’s a book by D. F. Rogers and J. A. Adams called “Mathematical Elements for Computer Graphics”. It’s a wonderful book, but it changed enormously when it came out in second edition. The first edition was type-written; the second edition was typeset with dramatically changed contents.
One of the major changes from the first edition was in the treatment of general 3-dimensional rotation matrices. The earlier edition had a wonderful derivation, using direction cosines (related to the Euler angles) of an arbitrary axis and vector calculus. In the later edition, this was replaced by a more modern, and admittedly simpler, treatment using conjugation (a sort of product) of matrices.
As a result of this change, something was lost: an elegant and symmetrical representation of the general rotation matrix. Here it is, simplified slightly (I have ignored the use of homogeneous coördinates, and assumed the axis of rotation passes through the origin):
where:
is a unit vector parallel to the axis of rotation,
and
, where
is the angle of rotation.
Notice that and
.
For convenient copy-and-paste here it is as text in a table, with exponentiation shown as (^) and multiplication as (*):
| u^2+(1-u^2)*c | u*v*(1-c)+w*s | u*w*(1-c)-v*s |
| u*v*(1-c)-w*s | v^2+(1-v^2)*c | v*w*(1-c)+u*s |
| u*w*(1-c)+v*s | v*w*(1-c)-u*s | w^2+(1-w^2)*c |