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 · 3 revisions

content/fmath.lua defines pplaf.fmath with functions from pewpew.fmath and some missing functions.

Functions

fx abs(fx a)

Returns absolute value of fx number.

pplaf.fmath.abs(-3.2048fx)

fx floor(fx a)

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

pplaf.fmath.floor(-3.2048fx)

fx ceil(fx a)

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

pplaf.fmath.ceil(-3.2048fx)

fx round(fx a)

Returns rounded fx number.

pplaf.fmath.round(-3.2048fx)

fx fraction(fx a)

Returns fraction part of fx number.

pplaf.fmath.fraction(-3.2048fx)

fx random(fx a, fx b)

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

pplaf.fmath.random(0fx, 10fx)

fx sqrt(fx a)

Returns square root of fx number. Redefine of fmath.sqrt()

pplaf.fmath.sqrt(5.2048fx)

fx, fx sincos(fx angle)

Returns sine and cosine of angle. Redefine of fmath.sincos()

pplaf.fmath.sincos(1.2048fx)

fx atan2(fx y, fx x)

Returns arctangent2 of y / x. Redefine of fmath.atan2()

pplaf.fmath.atan2(1fx, 2fx)

int to_int(fx a)

Transforms fx number to number and returns its integer part. Redefine of fmath.to_int()

pplaf.fmath.to_int(1.2048fx)

float to_number(fx a)

Transforms fx number to number and returns it.

pplaf.fmath.to_number(1.2048fx)

fx to_fx(float a)

Transforms number to fx number and returns it.

pplaf.fmath.to_fx(1.5)

fx length(fx dx, fx dy)

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

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)

fx sqlen(fx dx, fx dy)

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

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)

Clone this wiki locally