Options
All
  • Public
  • Public/Protected
  • All
Menu

Vec provides static function for vector operations. It's not yet optimized but good enough to use.

Hierarchy

  • Vec

Index

Methods

Static abs

Static add

Static ceil

Static cross

Static cross2D

Static divide

Static dot

Static floor

Static magnitude

  • magnitude(a: PtLike): number

Static map

  • Given a mapping function, update a's value in each dimension

    Parameters

    • a: PtLike
    • fn: function
        • (n: number, index: number, arr: any): number
        • Parameters

          • n: number
          • index: number
          • arr: any

          Returns number

    Returns PtLike

    vector a

Static max

  • Find the max value within a vector's dimensions

    Parameters

    Returns object

    an object with value and index that specifies the max value and its corresponding dimension.

    • index: any
    • value: any

Static min

  • Find the min value within a vector's dimensions

    Parameters

    Returns object

    an object with value and index that specifies the min value and its corresponding dimension.

    • index: any
    • value: any

Static multiply

Static round

Static subtract

Static sum

Static unit

  • Unit vector of a. If magnitude of a is already known, pass it in the second paramter to optimize calculation.

    Parameters

    • a: PtLike
    • Default value magnitude: number = undefined

    Returns PtLike

Generated using TypeDoc