Skip to content
This repository was archived by the owner on Aug 7, 2024. It is now read-only.
glebi574 edited this page Nov 27, 2023 · 4 revisions

content/math.lua defines pplaf.math with some of the removed math functions.

Functions

float abs(float a)

Returns absolute value of number.

pplaf.math.abs(-3.5)

int floor(float a)

Returns number, rounded to largest integer number, smaller than it.

pplaf.math.floor(-3.5)

int ceil(float a)

Returns number, rounded to smallest integer number, bigger than it.

pplaf.math.ceil(-3.5)

int round(float a)

Returns rounded number.

pplaf.math.round(-3.5)

float fraction(float a)

Returns fraction part of the number.

pplaf.math.fraction(-3.5)

int random(int a, int b)

Returns random number in the range [a; b]. Redefine of fmath.random_int()

pplaf.math.random(0, 10)

float sqrt(float a)

Returns square root of number.

pplaf.math.sqrt(5.5)

float length(float dx, float dy)

float length(float x1, float y1, float x2, float y2)

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)

float sqlen(float dx, float dy)

float sqlen(float x1, float y1, float x2, float y2)

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)

Clone this wiki locally