4.9.6 Other math functions

delta

delta( x ) // = offset of last frames value of x to current frames value of x

more about delta( x )


average

av( x, y, ... ,n ) // = average of x, y ... n (also works with vectors)

Example:
av( 2, 6, 500 ) // returns 254
av( -2, 6 ) // returns 4
av( vec( 4, 5, 6 ), vec( 7, 8, 9 ) ) // returns a vector with the components 5.5, 6.5, 7.5


speed

speed( x ) // = speed of x (only works with indexable variables)

Example:
speed( Cube.Position.X ) // returns the speed of the movement of Cube along the X axis (units/ second)


component speed

vspeed( v ) // = speed of v (only works with indexable vectors)

Example:
vspeed( Cube.Position )

// this returns a vector that containes the speed of each component of
// the movement of the Cube in space in units/ second

// You get the absolut speed of the Cube when you use the length function which will return a single value:

lenght( vspeed( Cube.Position ) )


fmod( x, y ) // = rest of division x / y (modulo of x using base y)

Example:
fmod( 15, 4 ) // returns 3
fmod( 36, 37 ) // returns 0


fact( n ) // = factoral n = 1 * 2 * ... * n (n is an integer, floats will be truncated)

Example:
fact( 3 ) // returns 6 (1 * 2 * 3)
fact( 5.367 ) // returns 120 (1 * 2 * 3 * 4 * 5)

Xpressionist 3.5