This class provides mathematical operations for internal purposes.

Static variables

@:value(PI / 2)staticinlineread onlyHALF_PI:Float = PI / 2

Shorthand for PI / 2.

@:value(-1e65536)staticinlineread onlyNEGATIVE_INFINITY:Float = -1e65536

Negative infinity.

@:value(3.14159265358979)staticinlineread onlyPI:Float = 3.14159265358979

The ratio of the circumference of a circle to its diameter.

@:value(1e65536)staticinlineread onlyPOSITIVE_INFINITY:Float = 1e65536

Positive infinity.

@:value(180 / PI)staticinlineread onlyTO_DEGREES:Float = 180 / PI

Shorthand for 180 / PI.

@:value(PI / 180)staticinlineread onlyTO_RADIANS:Float = PI / 180

Shorthand for PI / 180.

@:value(PI * 2)staticinlineread onlyTWO_PI:Float = PI * 2

Shorthand for PI * 2.

Static methods

staticinlineabs(x:Float):Float

Returns the absolute value of x.

staticinlineacos(x:Float):Float

Returns Math.acos(x).

staticinlineasin(x:Float):Float

Returns Math.asin(x).

staticinlineatan(x:Float):Float

Returns Math.atan(x).

staticinlineatan2(y:Float, x:Float):Float

Returns Math.atan2(y, x)

staticinlineclamp(x:Float, min:Float, max:Float):Float

Returns a clamped value of x from min to max.

staticinlinecos(x:Float):Float

Returns Math.cos(x).

staticinlinerand():Float

Returns Math.random().

staticinlinerandIn(min:Float, max:Float):Float

Returns a random value from min inclusive to max exclusive.

staticinlinerandVec3():Vec3

Returns a random Vec3 from (-1.0, -1.0, -1.0) inclusive to (1.0, 1.0, 1.0) exclusive.

staticinlinerandVec3In(min:Float, max:Float):Vec3

Returns a random Vec3 from (min, min, min) inclusive to (max, max, max) exclusive.

staticinlinesafeAcos(x:Float):Float

Returns Math.acos(clamp(-1, x, 1)). This never returns NaN as long as x is not NaN.

staticinlinesafeAsin(x:Float):Float

Returns Math.asin(clamp(-1, x, 1)). This never returns NaN as long as x is not NaN.

staticinlinesin(x:Float):Float

Returns Math.sin(x).

staticinlinesqrt(x:Float):Float

Returns Math.sqrt(x).

staticinlinetan(x:Float):Float

Returns Math.tan(x).