How do you calculate the reflex angle given to vectors in 3D space?
Posted
by Reimund
on Stack Overflow
See other posts from Stack Overflow
or by Reimund
Published on 2010-03-16T13:13:32Z
Indexed on
2010/03/16
13:16 UTC
Read the original article
Hit count: 371
I want to calculate the angle between two vectors a and b. Lets assume these are at the origin. This can be done with
theta = arccos(a . b / |a| * |b|)
However arccos gives you the angle in [0, pi], i.e. it will never give you an angle greater than 180 degrees, which is what I want. So how do you find out when the vectors have gone past the 180 degree mark? In 2D I would simply let the sign of the y-component on one of the vectors determine what quadrant the vector is in. But what is the easiest way to do it in 3D?
© Stack Overflow or respective owner