mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Add poly_line_length function
This commit is contained in:
parent
dcb58c1f4f
commit
3a05352f73
1 changed files with 7 additions and 0 deletions
|
@ -61,6 +61,13 @@ def normalize(
|
||||||
return np.zeros(len(vect))
|
return np.zeros(len(vect))
|
||||||
|
|
||||||
|
|
||||||
|
def poly_line_length(points):
|
||||||
|
"""
|
||||||
|
Return the sum of the lengths between adjacent points
|
||||||
|
"""
|
||||||
|
diffs = points[1:] - points[:-1]
|
||||||
|
return np.sqrt((diffs**2).sum(1)).sum()
|
||||||
|
|
||||||
# Operations related to rotation
|
# Operations related to rotation
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue