mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Changed implementation of angle_between
This commit is contained in:
parent
7a5c419297
commit
a65dbf27d9
1 changed files with 2 additions and 3 deletions
|
@ -142,9 +142,8 @@ def angle_between_vectors(v1, v2):
|
||||||
Returns the angle between two 3D vectors.
|
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 TAU/2.
|
||||||
"""
|
"""
|
||||||
l1 = get_norm(v1)
|
diff = (angle_of_vector(v1) - angle_of_vector(v2)) % TAU
|
||||||
l2 = get_norm(v2)
|
return min(diff, TAU - diff)
|
||||||
return np.arccos(np.dot(v1, v2) / (l1 * l2))
|
|
||||||
|
|
||||||
|
|
||||||
def project_along_vector(point, vector):
|
def project_along_vector(point, vector):
|
||||||
|
|
Loading…
Add table
Reference in a new issue