4.9.1.1 absolute value - abs( x )

The absolute value function returns the absolute value of any given argument. This means that the function will always return a positive value when the argument is negative. We show this by using a sine function as an argument for the abs function

sphere.YPosition = abs( sin( time * 90 ) * 2 );

this will invert the negative portion of the sine wave.

Since the abs function returns only positive values all negative values will be inverted. When used with vectors the abs function inverts all negative component values to positive values and returns a vector again.

The red curve represents the values of the argument. The blue curve represents the output of the abs function.

Xpressionist 3.5