Have rotation_between_vectors handle identical/similar vectors

This commit is contained in:
Grant Sanderson 2021-11-18 17:52:48 -08:00
parent eea3c6b294
commit 407c53f97c

View file

@ -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))