Options
All
  • Public
  • Public/Protected
  • All
Menu

Module vector

Index

Type aliases

Vector

Vector: { x: number; y: number }

Type declaration

  • x: number
  • y: number

Functions

Const addVector

  • Parameters

    • vector1: Vector

      represents first vector

    • vector2: Vector = ...

      represents second vector. Default to vector at origin

    Returns Vector

    new vector as a result of addition of two vectors

Const getUnitVector

Const getVector

  • getVector(x?: number, y?: number): Vector
  • Parameters

    • x: number = 0

      integer represents x coordinate

    • y: number = 0

      integer represents y coordinate

    Returns Vector

    vector with x, y coordinates

Const getVectorDistance

  • getVectorDistance(vector1: Vector, vector2?: Vector): number
  • Parameters

    • vector1: Vector

      represents first vector

    • vector2: Vector = ...

      represents second vector. Default to vector at origin

    Returns number

    distance between two vectors

Const getVectorSize

  • getVectorSize(vector: Vector): number
  • Parameters

    • vector: Vector

      represents position

    Returns number

    size of the vector

Const isSameVector

  • Parameters

    • vector1: Vector

      represents first vector

    • vector2: Vector

      represents second vector

    Returns boolean

    boolean indicate is vector is the same

Const scalarMultiplyVector

  • scalarMultiplyVector(scalar: number, vector: Vector): Vector
  • Parameters

    • scalar: number

      represents scalar value

    • vector: Vector

      represents vector

    Returns Vector

    new vector as a result of multiplication of scalar and vector

Const subtractVector

  • Parameters

    • vector1: Vector

      represents first vector

    • vector2: Vector = ...

      represents second vector. Default to vector at origin

    Returns Vector

    new vector as a result of subtraction of two vectors

Generated using TypeDoc