diff --git a/manimlib/utils/space_ops.py b/manimlib/utils/space_ops.py index 959fd198..196707ca 100644 --- a/manimlib/utils/space_ops.py +++ b/manimlib/utils/space_ops.py @@ -7,6 +7,7 @@ from manimlib.constants import PI from manimlib.constants import RIGHT from manimlib.constants import TAU from manimlib.utils.iterables import adjacent_pairs +from manimlib.utils.simple_functions import fdiv def get_norm(vect): @@ -140,10 +141,12 @@ def angle_of_vector(vector): def angle_between_vectors(v1, v2): """ Returns the angle between two 3D vectors. - This angle will always be btw 0 and TAU/2. + This angle will always be btw 0 and pi """ - diff = (angle_of_vector(v1) - angle_of_vector(v2)) % TAU - return min(diff, TAU - diff) + return np.arccos(fdiv( + np.dot(v1, v2), + get_norm(v1) * get_norm(v2) + )) def project_along_vector(point, vector):