Changed implementation of angle_between

This commit is contained in:
Grant Sanderson 2019-01-29 23:53:20 -08:00
parent 7a5c419297
commit a65dbf27d9

View file

@ -142,9 +142,8 @@ def angle_between_vectors(v1, v2):
Returns the angle between two 3D vectors.
This angle will always be btw 0 and TAU/2.
"""
l1 = get_norm(v1)
l2 = get_norm(v2)
return np.arccos(np.dot(v1, v2) / (l1 * l2))
diff = (angle_of_vector(v1) - angle_of_vector(v2)) % TAU
return min(diff, TAU - diff)
def project_along_vector(point, vector):