This repository was archived by the owner on Aug 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
math
glebi574 edited this page Nov 27, 2023
·
4 revisions
content/math.lua defines pplaf.math with some of the removed math functions.
- abs(float
a) - floor(float
a) - ceil(float
a) - round(float
a) - fraction(float
a) - random(int
a, intb) - sqrt(float
a) - length(float
dx, floatdy) - length(float
x1, floaty1, floatx2, floaty2) - sqlen(float
dx, floatdy) - sqlen(float
x1, floaty1, floatx2, floaty2)
Returns absolute value of number.
pplaf.math.abs(-3.5)Returns number, rounded to largest integer number, smaller than it.
pplaf.math.floor(-3.5)Returns number, rounded to smallest integer number, bigger than it.
pplaf.math.ceil(-3.5)Returns rounded number.
pplaf.math.round(-3.5)Returns fraction part of the number.
pplaf.math.fraction(-3.5)Returns random number in the range [a; b]. Redefine of fmath.random_int()
pplaf.math.random(0, 10)Returns square root of number.
pplaf.math.sqrt(5.5)Returns length of vector, defined as {dx; dy} or as coordinates of it's start and end: (x1; y1), (x2; y2).
pplaf.math.length(1, 1)
pplaf.math.length(1, 2, 5, 7)Returns squared length of vector, defined as {dx; dy} or as coordinates of it's start and end: (x1; y1), (x2; y2).
pplaf.math.sqlen(1, 1)
pplaf.math.sqlen(1, 2, 5, 7)