mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Have rotation_between_vectors handle identical/similar vectors
This commit is contained in:
parent
eea3c6b294
commit
407c53f97c
1 changed files with 2 additions and 0 deletions
|
@ -157,6 +157,8 @@ def z_to_vector(vector):
|
||||||
|
|
||||||
|
|
||||||
def rotation_between_vectors(v1, v2):
|
def rotation_between_vectors(v1, v2):
|
||||||
|
if np.all(np.isclose(v1, v2)):
|
||||||
|
return np.identity(3)
|
||||||
return rotation_matrix(
|
return rotation_matrix(
|
||||||
angle=angle_between_vectors(v1, v2),
|
angle=angle_between_vectors(v1, v2),
|
||||||
axis=normalize(np.cross(v1, v2))
|
axis=normalize(np.cross(v1, v2))
|
||||||
|
|
Loading…
Add table
Reference in a new issue