Namespace: MathX

MathX

Some extra Math functionality for your enjoyment.

Author:
  • derschmale <http://www.derschmale.com>

Members


<static> DEG_TO_RAD

The factor to convert degrees to radians.


<static> RAD_TO_DEG

The factor to convert radians to degrees.

Methods


<static> clamp()

Clamps a value to a minimum and maximum.


<static> estimateGaussianRadius(variance, epsilon)

Estimates the radius of a gaussian curve.

Parameters:
Name Type Description
variance

The variance of the gaussian curve.

epsilon

The minimum value of the curve to still be considered within the radius.


<static> isPowerOfTwo()

Verifies whether the value is a power of 2.


<static> lerp()

Linearly interpolates a number.


<static> linearStep()

Returns 0 if x < lower, 1 if x > lower, and linearly interpolates in between.


<static> log2()

Return the base-2 logarithm.


<static> saturate()

Clamps a value to 0 and 1


<static> sign()

Returns the sign of a given value.

Returns:

-1 if v < 0, 0 if v == 0, 1 if v > 1

Type
number