I have a rotation 2D rotation matrix. I know that this matrix will always ever only be a rotation matrix.
$$\left[ \begin{array}{@{}cc} \cos a & -\sin a \\ \sin a & \cos a \\ \end{array} \right]$$
How can I extract the rotation from this matrix?
The less steps, the better, since this will be done on a computer and I don't want it to constantly be doing a lot of computations!
Pick any non-zero vector $v$ and compute the angle between $v$ and $Av$, where $A$ is the matrix above.
A simple vector is $e_1 = \binom{1}{0}$, and $Ae_1 = \binom{\cos \alpha}{\sin \alpha} = \binom{A_{11}}{A_{21}}$, hence the angle $\alpha$ can be computed from $\text{atan2}(\sin \alpha, \cos \alpha) = \text{atan2}(A_{21}, A_{11}) $. (Note that $\text{atan2}$ usually takes the $y$-component as the first argument.)