Remove clamp function, redundant with np.clip

This commit is contained in:
Grant Sanderson
2018-06-07 11:50:25 -07:00
parent 978e7c1799
commit 47ea8082d1
2 changed files with 1 additions and 8 deletions

View File

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

View File

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