0

With fixed unit $\vec v_1$and unit $\vec v_2$, with vectors rooted at a common origin,and $\vec v_2$ allowed to range in a single plane, is there a function that generates angles, using only $\vec v_1$ and $\vec v_2$ in the range $[0^o, 360^o)$?

The solutions I have found on stack exchange include:

$\theta = cos^{-1} \frac{(\vec v_1 \cdot \vec v_2)}{\Vert \vec v_1 \Vert \times \Vert \vec v_2 \Vert}$

How to calculate the angle between 2 vectors in 3D space given a preset function

and $\theta = atan2((\vec v_1 \times \vec v_2 \cdot \vec v_n, \vec v_1 \cdot \vec v_2)$

(How to find an angle in range(0, 360) between 2 vectors?)

The formula $\theta = cos^{-1} \frac{(\vec v_1 \cdot \vec v_2)}{\Vert \vec v_1 \Vert \times \Vert \vec v_2 \Vert}$ yields:

$\theta ∈ [0^o, 180^o),$not the desired range $[0^o, 360^o)$

The alternate formula: $\theta = atan2((\vec v_1 \times \vec v_2 \cdot \vec v_n, \vec v_1 \cdot \vec v_2);$

$\vec v_n = \vec v_1 \times \vec v_2,$

with exceptions for co-linear.

What appears to happen is that when $\theta > 180^o, \vec v_n$ flips sign:

Given: $\vec v_1 = \{0, 1, 0\};$ $\vec v_2 = \{-1, 1, 0\}:$ $\vec v_n = \vec v_1 \times \vec v_2, = \{0,0,1\}.$

$\theta = 45^o;$ expected.

Given: $\vec v_1 = \{0, 1, 0\};$ $\vec v_2 = \{1, -1, 0\}:$ $\vec v_n = \vec v_1 \times \vec v_2, = \{0,0,-1\}.$

$\theta = 135^o;$ expected $225^o.$

The one solution I have seen is to pre-identify $\vec v_n$. It is undesirable.

The goal is not to identify what is clockwise, but simply to have a consistent $[0^o, 360^o)$ mechanism given two unit vectors with common origin in a single plane with $\vec v_n$ derived from fixed unit $\vec v_1$ and varying unit $\vec v_2$, in a single plane.

(converted to MathJax per request, first attempt, hope it looks OK).

Thanks for any and all insights!

  • 1
    Welcome to MSE. Please use MathJax to format mathematical equations in your questions. It is very easy to learn and makes things easier to read. – math-physicist Jun 03 '22 at 08:48
  • "The one solution I have seen is to pre-identify vn. It is undesirable." It sounds like you are asking for something that gives you continuously consistent angles for all unordered pairs of vectors. That's not possible. – Mark S. Jun 03 '22 at 18:23
  • It seems with fixed $$v_1,and,variable v_2$$ both with same origin, and in one plane, both unit vectors, then there ought to be a way to fix handedness between the two vectors. The issue seems to be the normal vector changes sign at > 180. – Neal Castagnoli Jun 03 '22 at 18:37
  • Note, from noticing the normal vector has two values, I added a function that defined a "negative" version and a "Positive" version. When the vector normal is negative, $Z<1 || Z = 0 && Y < 1 || Z = 0 && Y = 0 && X < 1$, adds a sign to atan2. That appears to give a result for at least one plane $(-\pi , \pi]$ I'll experiment with other planes as well. If there are other ways to determine the sign of a normal vector that are consistent, that may resolve this issue. Note, the essential issue is that the inner product has an embedded cosine in it. – Neal Castagnoli Jun 04 '22 at 03:16
  • Note that the second post you quote (which I wrote) says “In 3D, two arbitrarily placed vectors define their own axis of rotation, perpendicular to both. That axis of rotation does not come with a fixed orientation, which means that you cannot uniquely fix the direction of the angle of rotation either.” The flipping of the normal vector is just a symptom of that. Will the plane be varying with $v_2$ or will all possible $v_2$ lie within a single plane? – MvG Jun 06 '22 at 21:05
  • I wrote the following: "and $\vec v_2$ allowed to range in a single plane." Is that not sufficient, in your view? – Neal Castagnoli Jun 07 '22 at 22:52

0 Answers0