-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmath.d.tl
72 lines (69 loc) · 2.32 KB
/
math.d.tl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
local record lmath
tau: number
lerp: function<T>(t: number, a: number, b: number): number
lerp: function<T>(t: number, a: T, b: T): T
damp: function<T>(smoothing: number, dt: number, a: number, b: number): number
damp: function<T>(smoothing: number, dt: number, a: T, b: T): T
root: function(x: number, rpow: number): number
cbrt: function(x: number): number
ternary: function(condition: boolean, ifTrue: integer, ifFalse: integer): integer
ternary: function(condition: boolean, ifTrue: number, ifFalse: number): number
ternary: function<A>(condition: boolean, ifTrue: A, ifFalse: A): A
ternary: function<T, F>(condition: boolean, ifTrue: T, ifFalse: F): T | F
isnan: function(x: number): boolean
sign: function(x: number): integer
clamp: function(value: integer, vmin: integer, vmax: integer): integer
clamp: function(value: number, vmin: number, vmax: number): number
wrap: function(value: integer, vmin: integer, vmax: integer): integer
wrap: function(value: number, vmin: number, vmax: number): number
map: function(value: number, fromMin: number, fromMax: number, toMin: number, toMax: number): number
round: function(x: number): integer
roundStep: function(x: number, step: integer): integer
roundStep: function(x: number, step: number): number
end
return {
-- math.*
abs = math.abs,
acos = math.acos,
asin = math.asin,
atan = math.atan,
atan2 = math.atan2,
ceil = math.ceil,
cos = math.cos,
cosh = math.cosh,
deg = math.deg,
exp = math.exp,
floor = math.floor,
fmod = math.fmod,
frexp = math.frexp,
huge = math.huge,
ldexp = math.ldexp,
log = math.log,
log10 = math.log10,
max = math.max,
min = math.min,
modf = math.modf,
pi = math.pi,
pow = math.pow,
rad = math.rad,
random = math.random,
randomseed = math.randomseed,
sin = math.sin,
sinh = math.sinh,
sqrt = math.sqrt,
tan = math.tan,
tanh = math.tanh,
-- lithium.math.*
tau = lmath.tau,
lerp = lmath.lerp,
root = lmath.root,
cbrt = lmath.cbrt,
ternary = lmath.ternary,
isnan = lmath.isnan,
sign = lmath.sign,
clamp = lmath.clamp,
wrap = lmath.wrap,
map = lmath.map,
round = lmath.round,
roundStep = lmath.roundStep,
}