Math functions - pytha-3d-cad/pytha-lua-api GitHub Wiki

The complete Lua math library can be accessed by the Lua api. in addition, PYTHA offers a series of mathematical functions in the Global Environment. Mostly, these are trigonometric functions accepting degrees instead of radians.

Function Description
ABS(x) Returns math.abs(x).
ACOS(x) Returns the arc cosine of x (in degrees).
ASIN(x) Returns the arc sine of x (in degrees).
ATAN(y [,x]) Returns the arc tangent of y/x (in degrees) in the correct quadrant. See math.atan.
COS(x) Returns the cosine of x (in degrees).
IFTHEN(cond1, val1 [, ... [,val0]]) If cond1 == true return val1, else if ... else return val0 (which is by default nil).
PI Returns math.pi.
PYTHAGORAS(x [,y[, ...]]) Returns the square root of (x^2 [+y^2 +...]), i.e. the Euclidian distance for arbitrary dimensions.
SIN(x) Returns the sine of x (in degrees).
SQRT(x) Returns math.sqrt(x).
TAN(x) Returns the tangent of x (in degrees).

Remarks:

Upper case, lower case as well as camel case notations are allowed (e.g. SIN(x), sin(x), Sin(x)).