Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Changed implementation of angle_between

Grant Sandersona65dbf27d951
diff --git a/manimlib/utils/space_ops.py b/manimlib/utils/space_ops.py
index 50efb097f..959fd198a 100644
--- a/manimlib/utils/space_ops.py
+++ b/manimlib/utils/space_ops.py
@@ -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):