continued reorganisation
This commit is contained in:
parent
6f8a7322f2
commit
0a2d9a5694
22 changed files with 190 additions and 61 deletions
|
|
@ -1,16 +0,0 @@
|
|||
'''
|
||||
Implements numeric range clamping (idk why its not in the stdlib...)
|
||||
NOTE: the upper and lower bounds for clamping are inclusive
|
||||
'''
|
||||
def clamp(x: int, min: int, max: int) -> int:
|
||||
if x < min:
|
||||
return min
|
||||
elif x > max:
|
||||
return max
|
||||
return x
|
||||
|
||||
def clamp_min(x: int, min: int) -> int:
|
||||
return x if x > min else min
|
||||
|
||||
def clamp_max(x: int, max: int) -> int:
|
||||
return x if x < max else max
|
||||
Loading…
Add table
Add a link
Reference in a new issue