From 407c53f97c061bfd8a53beacd88af4c786f9e9ee Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Thu, 18 Nov 2021 17:52:48 -0800 Subject: [PATCH] Have rotation_between_vectors handle identical/similar vectors --- manimlib/utils/space_ops.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/manimlib/utils/space_ops.py b/manimlib/utils/space_ops.py index 52044d32..9c5e84d2 100644 --- a/manimlib/utils/space_ops.py +++ b/manimlib/utils/space_ops.py @@ -157,6 +157,8 @@ def z_to_vector(vector): def rotation_between_vectors(v1, v2): + if np.all(np.isclose(v1, v2)): + return np.identity(3) return rotation_matrix( angle=angle_between_vectors(v1, v2), axis=normalize(np.cross(v1, v2))