PlanetPhysics/Direction Cosine Matrix to Axis Angle of Rotation

The angle of rotation can be found from the trace of the direction cosine matrix to axis angle of rotation matrix $$ A_{11} + A_{22} + A_{33} = 3cos(\alpha) + (1 - cos(\alpha))(e_1^2 + e_2^2 + e_3^2)  $$

Noting that the axis of rotation is a unit vector and has a length of 1 means

$$ e_1^2 + e_2^2 + e_3^2 = 1 $$

therefore

$$ A_{11} + A_{22} + A_{33} = 1 + 2cos(\alpha) $$

rearranging gives

$$ \alpha = cos^{-1}( \frac{1}{2} (A_{11} + A_{22} + A_{33} - 1)) $$

Inverse cosine is a multivalued function and there are 2 possible solutions for $$\alpha$$. Normally, the convention is to choose the principle value such that $$ 0 < \alpha < \pi $$

As long as $$\alpha$$ is not zero, the unit vector is given by

$$ \left[ \begin{matrix} e_1 \\ e_2 \\ e_3 \end{matrix} \right] = \left[ \begin{matrix} \frac{(A_{23} - A_{32})}{2 sin(\alpha)} \\ \frac{(A_{31} - A_{13})}{2 sin(\alpha)} \\ \frac{(A_{12} - A_{21})}{2 sin(\alpha)} \end{matrix} \right] $$

Above equation should be proved at some time...