Find Angle Between Two Vectors
Calculate the angle between two vectors using ArcCos or Diamond Angle
Using ArcCos
For normalised vectors it is simply the of the dot product as the divisor will be .
This is the reverse of Dot Product
Using Diamond Angle
First calculate the diamond angle of both vectors, see Diamond Angle, and then just subtract the angle of one vector from the angle of another.
Code
Example Python code (requires the diamond_angle code from
Diamond Angle).
def angle_between(x1, y1, x2, y2):
a1 = diamond_angle(x1, y1)
a2 = diamond_angle(x2, y2)
return a2-a1