Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "math/utils"

Index

Functions

Functions

clamp

  • clamp(value: number, min: number, max: number): number
  • Also see cmap.

    Parameters

    • value: number
    • min: number
    • max: number

    Returns number

    value if between min and max, otherwise returns min if below min or max if above max.

cmap

  • cmap(value: number, min1: number, max1: number, min2: number, max2: number): number
  • Will clamp value if outside of range 2.

    Also see map and clamp.

    Parameters

    • value: number
    • min1: number
    • max1: number
    • min2: number
    • max2: number

    Returns number

    value converted from range 1 to range 2 and clamps if necessary

map

  • map(value: number, min1: number, max1: number, min2: number, max2: number): number
  • Also see cmap.

    Parameters

    • value: number
    • min1: number
    • max1: number
    • min2: number
    • max2: number

    Returns number

    value converted from range 1 to range 2

random

  • random(): number
  • random(max: number): number
  • random(min: number, max: number): number
  • Returns number

    random number between 0 and 1

  • Parameters

    • max: number

    Returns number

    random number between 0 and max

  • Parameters

    • min: number
    • max: number

    Returns number

    random number between min and max

Generated using TypeDoc