# rotation matrix $R$ to axis and angle

Is it possible to convert a $3 \times 3$ rotation matrix $R$ to axis and angle representation such that the axis $n = \left ( n_x, n_y, n_z \right )$ is enforced to have all positive values and the angle is bound between $\left [0, 2\pi \right )$. Right now I am using:

$$\theta = \cos^{-1} \left( \frac{R(1,1)+R(2,2)+R(3,3)-1}{2}\right) \\ nx = \frac{R(3,2)-R(2,3)}{2\sin(\theta)} \\ ny = \frac{R(1,3)-R(3,1)}{2\sin(\theta)} \\ nz = \frac{R(2,1)-R(1,2)}{2\sin(\theta)} \\$$

but this does not enforce either condition and has a singularity at $\theta = 0$.