Combining Two 3D Rotations

Once again, the easiest way of doing this (IMHO, at least) turns out to be quaternions: a rotation of $\theta$ about the (normalized) vector $\hat{v} = (v_0, v_1, v_2)$ is represented by the quaternion ${\bf q}=\mathrm{cos}(\theta/2) + \mathrm{sin}(\theta/2)*(v_0{\bf i}+v_1{\bf j}+v_2{\bf k})$; and quaternion multiplication is easy to compute. All you need are the base axioms ${\bf i}^2 = {\bf j}^2 = {\bf k}^2 = {\bf i}{\bf j}{\bf k} = -1$; note that the latter implies for instance that ${\bf i}{\bf j} = {\bf k}$ by simply multiplying both sides on the right by ${\bf k}$ — on the right, because multiplication of quaternions, like composition of rotations, isn't commutative: $\bf{i}\bf{j}=\bf{k}$ but $\bf{j}\bf{i}=-\bf{k}$!. Once you have your resultant quaternion, the axis can be extracted as the (normalized) imaginary part of the result and the angle can be found by taking the arc-cosine of the scalar part. See the Wikipedia page on quaternions and rotations for more details on just how this works.