Implement mod-viewable janitor-generated badness stats.
This commit is contained in:
parent
8933f77bf5
commit
9d264dcf3a
14 changed files with 1772 additions and 1112 deletions
15
files/helpers/math.py
Normal file
15
files/helpers/math.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
|
||||
def remap(input: float, smin: float, smax: float, emin: float, emax: float) -> float:
|
||||
t = (input - smin) / (smax - smin)
|
||||
return (1 - t) * emin + t * emax
|
||||
|
||||
def clamp(input: float, min: float, max: float) -> float:
|
||||
if input < min: return min
|
||||
if input > max: return max
|
||||
return input
|
||||
|
||||
def saturate(input: float) -> float:
|
||||
return clamp(input, 0, 1)
|
||||
|
||||
def lerp(a: float, b: float, t: float) -> float:
|
||||
return (1 - t) * a + t * b
|
Loading…
Add table
Add a link
Reference in a new issue