How to calculate angle between two vectors in 3D with clockwise or counter clockwise notation?

2.7k Views Asked by At

If I have vectors a and b sharing a common point of intersection then I know how to calculate angle between them by using the formula for dot product. But whether b lies to the right or left of a if I am moving along a can not be gotten from this.

What would be the easiest way to find out whether b lies left or right of a?

3

There are 3 best solutions below

2
On BEST ANSWER

In order for "left" and "right" to be defined you need to have a sense of turning direction. Generally this requires not only to a sense of the "forward" direction given by the vector $\mathbf a,$ but also to some sense of which way is "up."

If the vectors are constrained to lie in a plane and we have a viewpoint from which we can look "down" on the plane then left and right are intuitively clear. To tell whether the vector $\mathbf b$ is angled to the left or right of $\mathbf a,$ construct a vector by rotating $\mathbf a$ ninety degrees to the right, giving you a new vector $\mathbf v$ perpendicular to (and pointing to the right of) $\mathbf a.$

If you have the components of $\mathbf a$ in the usual $x,y$ coordinates, that is, $\mathbf a = (a_x,a_y),$ with the usual orientation of the axes, then you could write $\mathbf v = (a_y, -a_x).$

Now take the dot product $\mathbf b \cdot \mathbf v.$ If it is positive, $\mathbf b$ points to the right of $\mathbf a$; if negative, $\mathbf b$ points to the left of $\mathbf a.$

1
On

use cross product. The sign of cross product of a and b will let you know if the angle is clockwise or counter clockwise.

0
On

As David K and others pointed out, in order to distinguish “left” and “right” you need some reference. In a comment you describe consistently looking “down” onto the plane in which the vectors lie. Mathematically, you can specify this by choosing a fixed vector $\mathbf u$ that specifies the “up” direction relative to this plane. Once you have this, then you can distinguish the two rotation directions by examining the sign of $$\det\begin{bmatrix}\mathbf a&\mathbf b&\mathbf u\end{bmatrix} = \mathbf a\times\mathbf b\cdot\mathbf u.$$ If this value is positive, then the three vectors (in that order) form a right-handed set; if negative, then it’s left-handed. If it’s zero, then $\mathbf a$ and $\mathbf b$ must either be parallel or antiparallel, so the rotation direction is ambiguous, anyway.