Module flower.math
This set of functions extends the native lua 'math' function set with additional useful methods.
Info:
- Release: V3.0.0
- Author: Makoto
Functions
average (...) | Calculate the average of the values of the argument. |
sum (...) | Calculate the total values of the argument |
distance (x0, y0, x1, y1) | Calculate the distance. |
attenuation (distance) | Computes attenuation as a function of distance. |
normalize (x, y) | Get the normal vector |
Functions
- average (...)
-
Calculate the average of the values of the argument.
Parameters:
- ... a variable number of arguments, all of which should be numbers
Returns:
-
average
- sum (...)
-
Calculate the total values of the argument
Parameters:
- ... a variable number of arguments, all of which should be numbers
Returns:
-
total
- distance (x0, y0, x1, y1)
-
Calculate the distance.
Parameters:
- x0 Start position.
- y0 Start position.
- x1 (option)End position (note: default value is 0)
- y1 (option)End position (note: default value is 0)
Returns:
-
distance
- attenuation (distance)
-
Computes attenuation as a function of distance.
Parameters:
- distance Distance
Returns:
-
distance^(-2/3)
- normalize (x, y)
-
Get the normal vector
Parameters:
- x
- y
Returns:
-
x/d, y/d