GlyEngine 0.0.17
Create games and apps with lua
|
Functions | |
local function | abs (value) |
std.math.abs | |
local function | clamp (value, value_min, value_max) |
std.math.clamp | |
local function | clamp2 (value, value_min, value_max) |
std.math.clamp2 | |
local function | cycle (passed, duration) |
std.math.cycle | |
local function | dir (value, alpha) |
std.math.dir | |
local function | dis (x1, y1, x2, y2) |
std.math.dis | |
local function | dis2 (x1, y1, x2, y2) |
std.math.dis2 | |
local function | lerp (a, b, alpha) |
std.math.lerp | |
local function | map (value, in_min, in_max, out_min, out_max) |
std.math.map | |
local function | max (...) |
std.math.max | |
local function | min (...) |
std.math.min | |
local function | saw (value) |
std.math.saw | |
local function abs | ( | value | ) |
module
[in] | value |
value | as positive number |
local function clamp | ( | value | , |
value_min | , | ||
value_max | ) |
[in] | value | The value to clamp |
[in] | value_min | The minimum value that value can be clamped to. |
[in] | value_max | The maximum value that value can be clamped to. |
value | if value_min <= value <= value_max |
value_min | if value < value_min |
value_max | if value > value_max |
local function clamp2 | ( | value | , |
value_min | , | ||
value_max | ) |
[in] | value | The value to clamp |
[in] | value_min | The minimum value that value can be clamped to. |
[in] | value_max | The maximum value that value can be clamped to. |
local function cycle | ( | passed | , |
duration | ) |
periodic cycle
cycle
[in] | passed | |
[in] | duration |
0 | start of period |
0.5 | middle of period |
1 | end of period |
local function dir | ( | value | , |
alpha | ) |
direction
[in] | value | |
[in] | alpha | default=0 |
-1 | less than alpha if value < -alpha |
1 | greater than alpha if value > alpha |
0 | when is in alpha if abs(alpha) <= aplha |
local function dis | ( | x1 | , |
y1 | , | ||
x2 | , | ||
y2 | ) |
euclidean distance
[in] | x1 | The x coordinate of the first point. |
[in] | y1 | The y coordinate of the first point. |
[in] | x2 | The x coordinate of the second point. |
[in] | y2 | The y coordinate of the second point. |
local function dis2 | ( | x1 | , |
y1 | , | ||
x2 | , | ||
y2 | ) |
quadratic distance
[in] | x1 | The x coordinate of the first point. |
[in] | y1 | The y coordinate of the first point. |
[in] | x2 | The x coordinate of the second point. |
[in] | y2 | The y coordinate of the second point. |
local function lerp | ( | a | , |
b | , | ||
alpha | ) |
linear interpolation
[in] | a | The starting value |
[in] | b | The ending value |
[in] | alpha | The interpolation parameter, typically in the range [0, 1]. |
local function map | ( | value | , |
in_min | , | ||
in_max | , | ||
out_min | , | ||
out_max | ) |
re-maps
[in] | value | The value to be mapped from the input range to the output range. |
[in] | in_min | The minimum value of the input range. |
[in] | in_max | The maximum value of the input range. |
[in] | out_min | The minimum value of the output range. |
[in] | out_max | The maximum value of the output range. |
local function max | ( | ... | ) |
biggest number
local function min | ( | ... | ) |
smallest number
local function saw | ( | value | ) |
sawtooth
saw