Signed angle between two 3D vectors

  • Thread starter Thread starter cakeathon
  • Start date Start date
  • Tags Tags
    3d Angle Vectors
Click For Summary
SUMMARY

This discussion focuses on calculating the signed angle between two 3D vectors using the cross product and the right-hand rule. The formula for the unsigned angle is given as angle = arccos(A.B / |A||B|). To determine the signed angle, one must consider the normal vector of the plane defined by the two vectors, which can be found using the cross product. The handedness of the cross product is crucial, as it determines the direction of rotation and thus the sign of the angle.

PREREQUISITES
  • Understanding of 3D vector mathematics
  • Familiarity with cross product and dot product operations
  • Knowledge of the right-hand rule for determining vector orientation
  • Basic trigonometry, specifically the arccos function
NEXT STEPS
  • Research the implementation of vector mathematics in Python using NumPy
  • Learn about quaternion rotation for 3D transformations
  • Explore the concept of handedness in vector calculus
  • Study the applications of signed angles in computer graphics and physics simulations
USEFUL FOR

Mathematicians, computer graphics developers, and anyone involved in 3D modeling or physics simulations who needs to calculate angles between vectors accurately.

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 'positive' 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