[Math] Finding if 2 points are clockwise or anti-clockwise of each other

geometry

Say I have 2 vectors, for example $$v_1 = (0,1), v_2 = (1,0)$$

In this case I will say that $v_2$ rotates $90 \unicode{xb0} $ to $v_1$, as opposed to $-270 \unicode{xb0}$, as we take the least angle.

My question is that is there a formula to calculate this relative angle between 2 arbitrary vectors, to tell if it is clockwise or anticlockwise?

I have seen a similar answer in this question:
https://stackoverflow.com/questions/1165647/how-to-determine-if-a-list-of-polygon-points-are-in-clockwise-order

But I am not sure if it works for 2 points only (does it have to be a closed polygon?)

Best Answer

Identify $\Bbb C \cong \Bbb R^2$ in the usual way. The oriented angle formed by the pair $(z,w)$, that is, the angle from $z$ to $w$, counterclockwise, is the number $\arg(w\overline{z})$. This number is defined modulo $2\pi$.

Ok, you want the angle from $(1,0)$ to $(0,1)$. Write $z = 1$ and $w = i$ there. So: $$\arg(w\overline{z}) = \arg(i) = 90º.$$

So $v_1$ is obtained from $v_2$ after a rotation of $90º$ counterclockwise. If you let these guys swap roles, meaning, if you want the angle from $(0,1)$ to $(1,0)$, then call $z = i$ and $w = 1$. So: $$\arg(w\overline{z}) = \arg(-i) = 270º.$$ Hence $v_2$ is obtained from $v_1$ after a rotation of $270º$ counterclockwise (or equivalently, $90º$ clockwise).