Functions

The following functions are available in your GPU scripts (case insensitive).

MATHS
ABS(param) Returns the absolute value of the parameter. Example: ABS (-3) returns 3.
AVERAGE(param1; param2) Returns the average of a list of values. This function can have between 2 and 10 parameters separated by semicolons.
CLAMP(param; min; max) If param is in the range [min; max], returns param. If param is smaller than min, returns min. If param is greater than max, returns max.
Example: CLAMP (5; 10; 20) returns 10, CLAMP (15; 10; 20) returns 15 and CLAMP (25; 10; 20) returns 20.
EXP(param) Returns the exponential of param: eparam.
LOG(param) Returns the natural logarithm of param: ln (param).
LOG10(param) Returns the decimal logarithm of param: log10 (param) = ln (param) / ln (10).
LOG2(param) Returns the binary logarithm of param: log2 (param) = ln (param) / ln (2).
MIN(param1; param2) Returns the minimum of a list of values. This function can have between 2 and 10 parameters separated by semicolons.
MAX(param1; param2) Returns the maximum of a list of values. This function can have between 2 and 10 parameters separated by semicolons.
POW(param1; param2) Returns param1 to the param2 power: param1param2.
SIGN(param) Returns 1 if param is strictly positive, -1 if param is strictly negative, 0 if param is null.
SQR(param) Returns the square of param, i.e. param * param.
SQRT(param) Returns the square root of param.
TRIGONOMETRY
SIN(angle) Returns the sine of angle expressed in radians.
SIND(angle) Returns the sine of angle expressed in degrees.
ASIN(param) Returns the arc sine of param, expressed in radians. Param value must be between -1 and 1.
ASIND(param) Returns the arc sine of param, expressed in degrees. Param value must be between -1 and 1.
COS(angle) Returns the cosine of angle expressed in radians.
COSD(angle) Returns the cosine of angle expressed in degrees.
ACOS(param) Returns the arc cosine of param, expressed in radians. Param value must be between -1 and 1.
ACOSD(param) Returns the arc cosine of param, expressed in degrees. Param value must be between -1 and 1.
TAN(angle) Returns the tangent of angle expressed in radians.
TAND(angle) Returns the arc tangent of angle expressed in degrees.
ATAN(param) Returns the arc tangent of param, expressed in radians, with a value between -PI/2 and PI/2.
ATAND(param) Returns the arc tangent of param, expressed in degrees, with a value between -90° and 90°.
ATAN2(x,y) Returns the arc tangent of y/x, expressed in radians, with a value between -PI and PI.
ATAN2D(x,y) Returns the arc tangent of y/x, expressed in degrees, with a value between -180° and 180°.
ToRadians(angle) Converts an angle from degrees to radians.
ToDegrees(angle) Converts an angle from radians to degrees.
ROUNDING
CEILING(param) Returns the smallest integer value greater than or equal to param: CEILING (1.2) returns 2, CEILING (-1.2) returns -1.
FLOOR(param) Returns the largest integer value less than or equal to param: FLOOR (1.2) returns 1, FLOOR (-1.2) returns -2.
ROUND(param) Rounds the value to the nearest integer: ROUND (1.8) returns 2, ROUND (1.2) returns 1.
TRUNC(param) Returns the integer value obtained by removing the digits after the comma: TRUNC (1.2) returns 1, TRUNC (-1.2) returns -1.
CONDITIONAL
IF(test; param1; param2) Returns param1 if the test is true, param2 if the test is false.
'test' can use the following operators: <=,> =, >, <,>, =.
Example: IF (A < 4; 10; 20) returns 10 if A is strictly less than 4, and 20 otherwise.

Copyright © 2020 · All Rights Reserved · Wysilab