Implement mod-viewable janitor-generated badness stats.

This commit is contained in:
Ben Rog-Wilhelm 2023-04-22 08:25:17 -05:00
parent 8933f77bf5
commit 9d264dcf3a
14 changed files with 1772 additions and 1112 deletions

15
files/helpers/math.py Normal file
View 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