Add poly_line_length function

This commit is contained in:
Grant Sanderson
2023-02-16 15:02:15 -08:00
parent dcb58c1f4f
commit 3a05352f73

View File

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