Class MathUtil

Common utility methods for math operations.

Hierarchy

  • MathUtil

Constructors

Properties

degreeToRadFactor: number = ...

The conversion factor that degree to radian.

radToDegreeFactor: number = ...

The conversion factor that radian to degree.

zeroTolerance: number = 1e-6

The value for which all absolute numbers smaller than are considered equal to zero.

Methods

  • Clamps the specified value.

    Returns

    The result of clamping a value between min and max

    Parameters

    • v: number

      The specified value

    • min: number

      The min value

    • max: number

      The max value

    Returns number

  • Modify the specified d from degree to radian.

    Returns

    The radian value

    Parameters

    • d: number

      The specified d

    Returns number

  • Checks if a and b are almost equals. The absolute value of the difference between a and b is close to zero.

    Returns

    True if a almost equal to b, false otherwise

    Parameters

    • a: number

      The left value to compare

    • b: number

      The right value to compare

    Returns boolean

  • Determines whether the specified v is pow2.

    Returns

    True if the specified v is pow2, false otherwise

    Parameters

    • v: number

      The specified v

    Returns boolean

  • Modify the specified r from radian to degree.

    Returns

    The degree value

    Parameters

    • r: number

      The specified r

    Returns number

Generated using TypeDoc