1

Good day.

When finding the angle of rotation for a 3x3 pure rotation matrix, one need only consider that the trace of said matrix will live by the equation trace = 1 + 2sin(theta) where theta is the angle of rotation of said matrix, and that thus one can find the angle itself by simply re-arranging the equation as theta = arccos((trace - 1) / 2).

Now, this bit of math is all well and good, but one of the vary limiting parts of this approach is that it doesn't preserve the sign of the angle in question, which, put another way, means that given an angle of 80 degrees and an angle of 280 degrees this approach will, in both cases, return 80 degrees as 280 degrees = -80 degrees as stated prior, the answer is correct but the sign is not preserved in the process.

Thus, I have to ask, is there a way to calculate this rotation angle such that the sign of the rotation is preserved? Or equivalently, that it properly accounts for angles beyond 180 degrees?

If it's not mathmatically possible to do so, fine, but if it can be done, I'd really like to learn how, as unfortunately, this equation renders itself vary difficult to use, especially in the context of making things in C++, given that it quickly breaks down for angles beyond a half-rotation.

Tirous
  • 189
  • 5
  • 1
    This document may be relevant: https://www.gregslabaugh.net/publications/euler.pdf – NicNic8 Nov 19 '19 at 19:24
  • Not exactly what I wanted, but in truth the link you gave me has actually proven to be amazing helpful to a totally different problem I was having relating to rotation matrices, thanks lad! – Tirous Nov 19 '19 at 19:44
  • 1
    There’s an inherent ambiguity here: a rotation through an angle of $\theta$ about $\mathbf v$ is exactly the same as a rotation through $-\theta$ about $-\mathbf v$. It’s the choice of $\mathbf v$ that determines the direction of the rotation—$\mathbf v$ defines “up” relative to the rotation plane. Without knowing something beyond the rotation matrix itself, you can’t recover the original parameters, but you can choose $\mathbf v$ and $\theta$ so that they’re consistent. – amd Nov 19 '19 at 20:16

1 Answers1

1

Let $M$ be your matrix. There is some vector $v_1$ such that $\lVert v_1\rVert=1$ and that $M.v_1=v_1$. Fix some vector $v_2$ such that $\lVert v_2\rVert=1$ and that $\langle v_1,v_2\rangle=0$ and let $v_3=v_1\times v_2$. Then, for some $\theta\in[0,2\pi)$,$$M.v_2=\cos(\theta)v_2+\sin(\theta)v_3$$and$$M.v_3=-\sin(\theta)v_2+\cos(\theta)v_3.$$Note that $\cos(\theta)=\langle M.v_2,v_2\rangle$ and that $\sin(\theta)=\langle M.v_2,v_3\rangle$. This $\theta$ is the angle that you are interested in.