Math Functions  (Animation Script)

Math functions are used to compute common mathematical operations including sin/cos, absolute value.

Parameter Modifiers
( - ) Use negative of value for function parameter

Notations

float - Scalar floating point constant or VERTEX variable component (.x/.y/.z)


Functions Description and parameter type variations
absv Absolute value

float absv(float x)
Retuns absolute value of x

iDivide

Integer divide

float iDivide(float x, float y)
returns remainder after integer division of x/y

float iDivide(float x, float y, float Result)
Result variable is assigned integer division result of x/y
returns remainder after integer division of x/y

*Divide by 0 results in 0

sqrt Square root

float sqrt(float x)
returns square root of x
if x parameter is < 0, returns -sqrt(absv(x))

powxy Exponent, x to power y

float powxy(float x, float y)
returns x raised to power y
if x parameter is < 0 and y is non-integer value, returns 0
cos Cosine of value in Degrees

float cos(float Degrees)
returns cosine of Degrees parameter
sin Sine of value in Degrees

float sin(float Degrees)
returns sine of Degrees parameter
tan Tangent of value in Degrees

float tan(float Degrees)
returns tangent of Degrees parameter
returns 0 for any multiple of 90 or 270
arccos Arc cosine of value

float arccos(float x)
returns arc cosine of x parameter in degrees

*x parameter is clamped in range of -1 - 1

arcsin Arc sine of value

float arcsin(float x)
returns arc sine of x parameter in degrees

*x parameter is clamped in range of -1 - 1

arctan Arc tangent of value

float arctan(float x)
return arc tangent of x parameter in degrees
Examples

VERTEX v, Angle

v.Set(0.577, 14, 225)

Angle.x = cos(v.z)
Angle.y = arcsin(v.x)

//v.x = remainder after integer division, 2, v.z = integer divide result, 4
v.x = iDivide(v.y, 3, v.z)

//v.x = absolute value
v.x = absv(Angle.x)

//Square root
v.y = sqrt(v.y)