Orthonormal Basis - Angle of Rotation with respect to Standard Orthonormal Basis

306 Views Asked by At

I have an orthonormal basis ${\bf{b}}_1$ and ${\bf{b}}_2$ in $\mathbb{R}^2$. I want to find out the angle of rotation. I added a little picture here. I essentially want to find $\theta$

enter image description here

I know that I can compute the angle between two vectors but then there are $4$ combinations here

  • $\theta_{11} = \arccos({\bf{b}}_1^\top{\bf{e}}_1)$
  • $\theta_{12} = \arccos({\bf{b}}_1^\top{\bf{e}}_2)$
  • $\theta_{21} = \arccos({\bf{b}}_2^\top{\bf{e}}_1)$
  • $\theta_{22} = \arccos({\bf{b}}_2^\top{\bf{e}}_2)$

How would one know which angle is correct? Importantly, here I used the labels $b_1$, $b_2$ in the same order as $e_1$ and $e_2$ but that's not necessarily the same order geometically!

4

There are 4 best solutions below

2
On BEST ANSWER

Let $\mathbf{b}_1 = (x_1, y_1)$. Then, $\theta = \operatorname{atan2}(y_1, x_1)$.

$\operatorname{atan2}(y_1, x_1)$ is the two-argument form of arcus tangent, equivalent to $\arctan(y_1 / x_1)$ except that the two-argument form takes the quadrant (signs of both $x_1$ and $y_1$) into account.


If you do not know which of $\mathbf{b}_1 = (x_1, y_1)$ and $\mathbf{b}_2 = (x_2, y_2)$ to use, then $$\begin{aligned} d &= x_1 y_2 - x_2 y_1 \\ \theta &= \begin{cases} \operatorname{atan2}(y_1, x_1), & d \ge 0 \\ \operatorname{atan2}(y_2, x_2), & d \lt 0 \\ \end{cases} \end{aligned}$$ Here, $d \gt 0$ if $\mathbf{b}_2$ is counterclockwise from $\mathbf{b}_1$, and $d \lt 0$ if clockwise. This uses the vector which is the clockwise one of the pair.


Note that for arbitrary coordinate system $\mathbf{e}_1$, $\mathbf{e}_2$, you can use $$\begin{aligned} x_1 &= \mathbf{b}_1^T \mathbf{e}_1 \\ y_1 &= \mathbf{b}_1^T \mathbf{e}_2 \\ x_2 &= \mathbf{b}_2^T \mathbf{e}_1 \\ y_2 &= \mathbf{b}_2^T \mathbf{e}_2 \\ \end{aligned}$$ above.

0
On

You may want to consider using the complex plane in this situation. Each point in the $\,x\,y\,$ plane is associated with a complex number. Thus, $\,\mathbf{e}_1 \equiv 1\,$ and $\,\mathbf{e}_2 \equiv i.\,$ Similarly, for any two orthogonal unit basis vectors $\,\mathbf{b}_1 \equiv z_1\,$ and $\,\mathbf{b}_2 \equiv z_2\,$ where $\,z_2 = z_1 i.\,$ More precisely, if $\,\mathbf{b}_1 := (x_1,y_1),\,$ then $\,\mathbf{b}_2 := (x_2,y_2) = (-y_1,x_1).$ You may need to reverse the roles of $\,\mathbf{b}_1\,$ and $\,\mathbf{b}_2\,$ to ensure this.

Because $\,\mathbf{b}_1\,$ is a unit vector, we get $\,z_1 = e^{i\theta}\,$ for some angle $\,\theta.$ Compute this angle using $\,\theta = \text{atan2}(y,x)\,$ where atan2 is the "2-argument arctangent". If $\,\text{atan2}\,$ is not available, use the identity $$\text{atan2}(y,x) = 2\arctan\left(\frac{y}{x+\sqrt{x^2+y^2}}\right).$$

1
On

The simplest way is to construct orthogonal matrix with column vectors $B=[b_1 \ \ b_2 \ \ b_1 \times b_2]$.
(I assume here that $b_1$ and $b_2$ are normalized to unit length) and to use trace of such matrix $\text{tr}(B)$.

Then we have immediately $\text{tr}(B)=1+2\cos(\theta)$.

See also https://en.wikipedia.org/wiki/Rotation_matrix#Determining_the_angle

0
On

You have drawn the angle $\theta$ as an arc from ${\bf e}_1$ to ${\bf b}_1,$ so apparently you already know intuitively that this is the angle you want, implying that you want you use the angle $\theta_{11} = \arccos( {\bf b}_1^\top {\bf e}_1).$ But this is only half the story.

You are rotating both basis vectors in the same direction in the same plane, so you will always find that

$$ \cos(\theta_{11}) = {\bf b}_1^\top {\bf e}_1 = {\bf b}_2^\top {\bf e}_2 = \cos(\theta_{22}). $$

Choose either one, it's the same either way.

Another way to see this is to observe from the figure that the pair of vectors $({\bf e}_2, {\bf b}_2)$ is just the pair of vectors $({\bf e}_1, {\bf b}_1)$ rotated by a right angle counterclockwise. The angle between each pair of vectors is the same.

Now for the other half of the story:

When you take the arc cosine, you get an angle $\theta$ in the range $0 \leq \theta \leq \pi,$ indicating that you can rotate ${\bf e}_1$ and ${\bf e}_2$ to ${\bf b}_1$ and ${\bf b}_2$ by rotating them through $\theta$ radians in either the counterclockwise or clockwise direction. But this result does not tell you whether the rotation is clockwise or counterclockwise.

By convention, we usually want $\theta$ to be positive for a counterclockwise rotation, negative for a clockwise rotation.

Assuming the vectors ${\bf e}_1$ and ${\bf e}_2$ are arranged in the usual counterclockwise orientation as shown in your figure, a counterclockwise rotation more than $0$ but less than $\pi$ radians will put ${\bf b}_1$ on the same side of ${\bf e}_1$ as ${\bf e}_2$, so ${\bf b}_2^\top {\bf e}_1$ will be positive. With a clockwise rotation, ${\bf b}_2^\top {\bf e}_1$ will be negative. So a rule to decide the direction of rotation is:

  • Counterclockwise if ${\bf b}_2^\top {\bf e}_1 > 0$, so let $\theta = \arccos({\bf b}_1^\top {\bf e}_1).$
  • Clockwise if ${\bf b}_2^\top {\bf e}_1 < 0$, so let $\theta = -\arccos({\bf b}_1^\top {\bf e}_1).$

If ${\bf b}_2^\top {\bf e}_1 = 0$ then either direction of rotation has the same result, so you can choose arbitrarily.

Note that in general you will find that ${\bf b}_2^\top {\bf e}_1 = - {\bf b}_1^\top {\bf e}_2.$