Finding Signed Angle Between Vectors Finding Signed Angle Between Vectors python python

Finding Signed Angle Between Vectors


What you want to use is often called the “perp dot product”, that is, find the vector perpendicular to one of the vectors, and then find the dot product with the other vector.

if(a.x*b.y - a.y*b.x < 0)    angle = -angle;

You can also do this:

angle = atan2( a.x*b.y - a.y*b.x, a.x*b.x + a.y*b.y );


If you have an atan2() function in your math library of choice:

signed_angle = atan2(b.y,b.x) - atan2(a.y,a.x)