-
Notifications
You must be signed in to change notification settings - Fork 0
fmath
content/fmath.lua defines pplaf.fmath with functions from pewpew.fmath and some missing functions.
- abs(fx
a) - floor(fx
a) - ceil(fx
a) - round(fx
a) - fraction(fx
a) - random(fx
a, fxb) - sqrt(fx
a) - sincos(fx
angle) - atan2(fx
y, fxx) - to_int(fx
a) - to_number(fx
a) - to_fx(float
a) - length(fx
dx, fxdy) - length(fx
x1, fxy1, fxx2, fxy2) - sqlen(fx
dx, fxdy) - sqlen(fx
x1, fxy1, fxx2, fxy2)
Returns absolute value of fx number.
pplaf.fmath.abs(-3.2048fx)Returns fx number, rounded to largest integer fx, smaller than it.
pplaf.fmath.floor(-3.2048fx)Returns fx number, rounded to smallest integer fx, bigger than it.
pplaf.fmath.ceil(-3.2048fx)Returns rounded fx number.
pplaf.fmath.round(-3.2048fx)Returns fraction part of fx number.
pplaf.fmath.fraction(-3.2048fx)Returns random fx number in the range [a; b]. Redefine of fmath.random_fixedpoint()
pplaf.fmath.random(0fx, 10fx)Returns square root of fx number. Redefine of fmath.sqrt()
pplaf.fmath.sqrt(5.2048fx)Returns sine and cosine of angle. Redefine of fmath.sincos()
pplaf.fmath.sincos(1.2048fx)Returns arctangent2 of y / x. Redefine of fmath.atan2()
pplaf.fmath.atan2(1fx, 2fx)Transforms fx number to number and returns its integer part. Redefine of fmath.to_int()
pplaf.fmath.to_int(1.2048fx)Transforms fx number to number and returns it.
pplaf.fmath.to_number(1.2048fx)Transforms number to fx number and returns it.
pplaf.fmath.to_fx(1.5)Returns length of vector, defined as {dx; dy} or as coordinates of it's start and end: (x1; y1), (x2; y2).
pplaf.fmath.length(1fx, 1fx)
pplaf.fmath.length(1fx, 2fx, 5fx, 7fx)Returns squared length of vector, defined as {dx; dy} or as coordinates of it's start and end: (x1; y1), (x2; y2).
pplaf.fmath.sqlen(1fx, 1fx)
pplaf.fmath.sqlen(1fx, 2fx, 5fx, 7fx)