Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Functions

  • clamped(num: number, min: number, max: number): number
  • Bound a number between some minimum and maximum value, inclusively.

    Parameters

    • num: number

      The current value

    • min: number

      The minimum allowed value

    • max: number

      The maximum allowed value

    Returns number

    The clamped number

  • mix(a: number, b: number, w: number): number
  • Linear interpolation function

    Parameters

    • a: number

      An initial value when weight is 0.

    • b: number

      A terminal value when weight is 1.

    • w: number

      A weight between 0 and 1.

    Returns number

    The interpolated value between a and b with weight w.

  • normalizeDegrees(degrees: number, base?: number): number
  • Transform an angle in degrees to be bounded within the domain [0, 360]

    Parameters

    • degrees: number

      An angle in degrees

    • base: number = 0

    Returns number

    The same angle on the range [0, 360) or (0, 360]

  • normalizeRadians(radians: number): number
  • Transform an angle in radians to be bounded within the domain [-PI, PI]

    Parameters

    • radians: number

      An angle in degrees

    Returns number

    The same angle on the range [-PI, PI]

  • roundDecimals(number: number, places: number): number
  • Round a floating point number to a certain number of decimal places

    Parameters

    • number: number

      A floating point number

    • places: number

      An integer number of decimal places

    Returns number

  • toDegrees(angle: number): number
  • Transform an angle in radians to a number in degrees

    Parameters

    • angle: number

      An angle in radians

    Returns number

    An angle in degrees

  • toRadians(angle: number): number
  • Transform an angle in degrees to an angle in radians

    Parameters

    • angle: number

      An angle in degrees

    Returns number

    An angle in radians

  • oscillation(minVal: number, maxVal: number, t: number, p?: number, func?: Function): number
  • Get an oscillation between lVal and hVal according to t

    Parameters

    • minVal: number

      The minimal value of the oscillation.

    • maxVal: number

      The maximum value of the oscillation.

    • t: number

      The time value.

    • p: number = 1
    • func: Function = Math.cos

    Returns number

    The oscillation according to t.

  • roundFast(x: number): number
  • TODO: Add deprecation in V11 or V12 To keep compatibility with previous implementation. roundFast was bugged and the performance advantage was not there.

    Parameters

    • x: number

    Returns number