Finding sign of an angle without calculating the angle itself

85 Views Asked by At

Say we have an angle between vectors $P_1$ and $P_2$ in $\mathbb R^2$ whose vertex, $O$, is at the origin. I would like to know the sign of the smallest signed angle between $P_1$ and $P_2$ such that $\overrightarrow{O{P_1}}$ is rotated to become overlaid on $\overrightarrow{O{P_2}}$. It is too computationally expensive for me to use trigonometric functions to calculate the angle itself and then find the sign. Is there a good way to do this?

1

There are 1 best solutions below

3
On BEST ANSWER

Check the sign of the coefficient of $\hat{k}$ of the cross product of both vectors.

For example, let $P_1=(5,0)$, $P_2=(-3,6)$ , $\overrightarrow{OP_1}\times \overrightarrow{OP_2}=30\hat{k}$, so it's a counterclockwise smallest turn. Switching both vectors will result in a negative coefficient for $\hat{k}$, indicating a clockwise smallest turn.

Basically for $P_1(a,b), P_2(c,d)$, and turning from $\overrightarrow{OP_1}$ to $\overrightarrow{OP_2}$, you test sign of $ad-bc$ for the direction of smallest turn (positive for counterclockwise). In the case the result is $0$, either way is the same.