Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Remove clamp function, redundant with np.clip

Grant Sanderson47ea8082d1ba
diff --git a/old_projects/WindingNumber.py b/old_projects/WindingNumber.py
index b94a5ef6e..d1be742bf 100644
--- a/old_projects/WindingNumber.py
+++ b/old_projects/WindingNumber.py
@@ -424,7 +424,7 @@ def make_alpha_winder(func, start, end, num_checkpoints, cheap = False):
if cheap:
return alpha # A test to see if this func is responsible for slowdown
- index = clamp(0, num_checkpoints - 1, int(alpha * num_checkpoints))
+ index = np.clip(0, num_checkpoints - 1, int(alpha * num_checkpoints))
x = interpolate(start, end, alpha)
if cheap:
return check_points[index] # A more principled test that at least returns a reasonable answer
diff --git a/utils/bezier.py b/utils/bezier.py
index c09267252..e4a4a2a01 100644
--- a/utils/bezier.py
+++ b/utils/bezier.py
@@ -55,13 +55,6 @@ def match_interpolate(new_start, new_end, old_start, old_end, old_value):
)
-def clamp(lower, upper, val):
- if val < lower:
- return lower
- elif val > upper:
- return upper
- return val
-
# Figuring out which bezier curves most smoothly connect a sequence of points