Total Complexity | 5 |
Total Lines | 34 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | from math import sin, cos, tan |
||
2 | from math import asin, acos, atan |
||
3 | from math import sinh, cosh, tanh |
||
4 | from math import asinh, acosh, atanh |
||
5 | from math import atan2 |
||
6 | |||
7 | from math import sqrt |
||
8 | |||
9 | from math import pi as PI |
||
10 | from math import tau as TAU |
||
11 | from math import e as E |
||
12 | |||
13 | from random import random as py_random |
||
14 | |||
15 | def random(x=1): |
||
16 | return py_random() * x |
||
17 | |||
18 | |||
19 | def clamp(value, min, max): |
||
20 | return (value <= min)*min + (value >= max)*max + value*(value > min and value < max) |
||
21 | |||
22 | |||
23 | def lerp_unclamped(start, end, t): |
||
24 | return start + t*(end-start) |
||
25 | |||
26 | |||
27 | def lerp(start, end, t): |
||
28 | value = lerp_unclamped(start, end, t) |
||
29 | return clamp(value, start, end) |
||
30 | |||
31 | |||
32 | def mix(a, b, t): |
||
33 | return lerp(a, b, t) |
||
34 |