Calculating clockwise/anti-clockwise angles from a point

7k Views Asked by At

I'm currently trying to work out if an angle is a clockwise or anti-clockwise rotation about a point. I used the equation: a.b = ||a|| ||b|| cos(A) to calculate the angle between the two vectors in 3D space, but I'm now unsure as to how to tackle the clockwise/anti-clockwise problem and would really appreciate some help on how to approach it.

enter image description here

Thank you!

2

There are 2 best solutions below

3
On BEST ANSWER

In three dimensions, this requires a choice of orientation of the plane $P$ spanned by ${\bf a}, {\bf b}$. We can specify such an orientation by choosing a vector $\bf n$ transverse to $P$; then, the basis (${\bf a}, {\bf b}$) is positively oriented with respect to the orientation---equivalently, the angular displacement from $\bf a$ to $\bf b$ is anticlockwise from the p.o.v. of the endpoint of $\bf n$---if $$\det \begin{pmatrix} {\bf a} & {\bf b} & {\bf n} \end{pmatrix} > 0$$ and the reverse is true, and in particular the displacement is clockwise, if $$\det \begin{pmatrix} {\bf a} & {\bf b} & {\bf n} \end{pmatrix} < 0.$$

NB in two dimensions, there is a conventional choice of orientation of the plane, and if we write ${\bf a} = (a_1, a_2)^T$ and ${\bf b} = (b_1, b_2)^T$, then we have $$\det \begin{pmatrix} {\bf a} & {\bf b} \end{pmatrix} = a_1 b_2 - a_2 b_1 > 0$$ if the displacement is anticlockwise and the reverse inequality if it is clockwise.

0
On

3D version is covered by Travis and tells you that in 3D you need 3 vectors to define orientation. All you can tell is the vector $\vec{a}\times\vec{b}$ (there isn't just $+$ and $-$ but entire space of 3D vectors that encodes the orientation of a plane defined by the two vectors).

In 2D:

The dot product gives you the cosine. The cross product (2D equivalent which gives you a pseudo-scalar) gives you the sine. Together they define the angle.

$$\vec{a}\cdot\vec{b}=|a||b|\cos\alpha$$ $$\vec{a}\times\vec{b}=|a||b|\sin\alpha$$ where $\times$ should be interpreted as the 3rd component of the 3D version. In other terms:

$$a_x b_x+a_yb_y=|a||b|\cos\alpha$$ $$a_x b_y-a_y b_x=|a||b|\sin\alpha$$

Or, if you are willing to use complex numbers, you just remember that dividing complex numbers subtracts the arguments. Representing the $2D$ vectors as complex numbers, you get $$\cos\alpha+{\rm i}\sin\alpha=e^{i\alpha}=\frac{b/|b|}{a/|a|}$$