Signed angle between two 3D vectors

  • Thread starter Thread starter cakeathon
  • Start date Start date
  • Tags Tags
    3d Angle Vectors
Click For Summary
To calculate the signed angle between two 3D vectors, first determine the unsigned angle using the formula angle = arccos(A.B / |A||B|). The signed angle can be derived by considering the cross product of the vectors, which indicates the direction of rotation. The normal vector from the cross product helps establish the rotation's handedness, determining whether the angle is positive or negative. It's important to note that the cross product is anti-commutative, meaning the order of the vectors affects the sign of the angle. Understanding these principles allows for consistent angle definitions in any orientation of the plane defined by the vectors.
cakeathon
Messages
3
Reaction score
0
Hi all, I am looking for some help please.

I want to calculate the signed angle between two 3D (x,y,z) vectors. I know the formula to find the unsigned angle;

angle = arccos(A.B / |A||B|)

but how do I get the signed angle? From searching through the internet it seems that there isn't an obvious/easy solution ?


To clarify: Assume the two vectors can lie on any plane. Taking the first vector as a reference I want to know the angle that I would need to rotate the first vector to line it up with the second vector.


Can someone more clever than me point me in the right direction, or prehaps offer a solution please ?
 
Physics news on Phys.org
The sign of the angle depends on the axis you use.

Take the angle between x = (0, 1, 0) and y = (1, 0, 0). We see that y is actually x rotated 90 degrees along the z axis (described by the vector (0, 0, 1)). But we can equivalently say that y is x rotated -90 degrees through the negative z axis (described (0, 0, -1)).

Suppose you have two points, p1 and p2, such that p2 is p1 rotated in some plane. A plane is uniquely specified by three points (assuming that all three are distinct and do not lie on a single line). The plane of our rotation is defined by the origin, p1, and p2.

The axis about which they rotate is the normal of this plane. Each plane actually has two normals (a positive one and a negative one), which can be found by taking either the left-handed or right-handed cross product of p1 and p2.

Once you have chosen which axis you want, you can define positive rotation to be the usual counter-clockwise direction along that axis.
 
Thanks Tic Tac, I understand what you are saying. Let me give you an example of my problem:

keeping things simple for my small brain, we have two vectors on (lets say) the xy plane
vec1 = 1,0,0
vec2 = 1,1,0

the cross product, CP = 0,0,+1 (in the 'positive' direction) and the angle between them is 45 degress. (Using right hand rule, vec1 is rotated counter clockwise around CP by 45 degrees to align with vec2). Perfect.


now let's say vec2 = -1,1,0. CP is still 0,0,+1 and the angle is +135 degrees. Perfect.

now let's say vec2 = -1,-1,0. But now the CP flips to the other direction and CP is now 0,0,-1 (in the 'negative' direction) and the angle is +45. But actually I want the angle answer to be -45.


So maybe the question I should ask is how do I work out if the Cross Product of my two vectors is in the 'postive' direction rather than the 'negative' direction for the plane defined by my two vectors. In the real world this plane can be in any orientation.
 
now let's say vec2 = -1,-1,0. But now the CP flips to the other direction and CP is now 0,0,-1 (in the 'negative' direction) and the angle is +45. But actually I want the angle answer to be -45.

You can't have your cake that way.

As long as you've fixed your cross product's handedness, there will be situations where the normal flips. It may look inconvenient to you, but it ensures that the cross product is continuous and the angles are defined in a consistent way.

It might help to realize there is no general distinction between the "negative" normal and the "positive" one. For the z-axis, it makes sense, but take a pair of vectors like [1, 1, 0] and [0, 1, 1]. The two normal possibilities are then [1, -1, 1] and [-1, 1, -1], and it's not clear either is "positive". The best you can do is say one is right-handed versus left handed.

Also, note the property of the cross product that it is anti-commutative. For all a and b, a x b = -(b x a).
 
Tac-Tics said:
It might help to realize there is no general distinction between the "negative" normal and the "positive" one. For the z-axis, it makes sense, but take a pair of vectors like [1, 1, 0] and [0, 1, 1]. The two normal possibilities are then [1, -1, 1] and [-1, 1, -1], and it's not clear either is "positive". The best you can do is say one is right-handed versus left handed.

Yes that does help, I can see your point. Thankyou :smile:
 

Similar threads

  • · Replies 26 ·
Replies
26
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 7 ·
Replies
7
Views
3K
Replies
1
Views
1K
  • · Replies 53 ·
2
Replies
53
Views
4K
  • · Replies 9 ·
Replies
9
Views
2K
Replies
4
Views
2K
Replies
21
Views
3K
  • · Replies 12 ·
Replies
12
Views
2K