Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Implements

Index

Constructors

Properties

x: number

X coordinate of the vector

y: number

Y coordinate of the vector

Accessors

  • get angle(): number
  • set angle(angle: number): void
  • get length(): number
  • set length(length: number): void

Methods

  • Adds the current and the given vector together, without modifying them

    Parameters

    • v: Vector

      the vector used for the sum operation

    Returns Vector

    the sum vector

  • Calculates the distance between the current vector and the given one

    Parameters

    • v: Vector

      the vector used for calculating the distance from the current one

    Returns number

    the distance between the vectors

  • distanceToSq(v: Vector): number
  • Get the distance squared between two vectors

    Parameters

    • v: Vector

      the vector used for calculating the distance from the current one

    Returns number

    the distance squared between the vectors

  • Divides the given scalar and the current vector together, without modifying it

    Parameters

    • n: number

      the scalar value to divide from the current vector

    Returns Vector

  • divTo(n: number): void
  • Divides the given scalar from the current vector, modifying it

    Parameters

    • n: number

      the scalar value to divide from the current vector

    Returns void

  • getLengthSq(): number
  • manhattanDistanceTo(v: Vector): number
  • Returns the Manhattan distance between all vectors

    Parameters

    • v: Vector

      the vector used for calculating the distance from the current one

    Returns number

    the Manhattan distance between the vectors

  • Multiplies the given scalar and the current vector together, without modifying it

    Parameters

    • n: number

      the scalar value to multiply to the vector

    Returns Vector

    the multiplied vector

  • multTo(n: number): void
  • Multiplies the given scalar to the current vector, modifying it

    Parameters

    • n: number

      the scalar value to multiply to the vector

    Returns void

  • Subtracts the current and the given vector together, without modifying them

    Parameters

    • v: Vector

      the vector used for the subtract operation

    Returns Vector

    the subtracted vector

  • Subtracts the given vector from the current one, modifying it

    Parameters

    • v: Vector

      the vector to subtract from the current one

    Returns void

  • updateFromAngle(angle: number, length: number): void
  • Updates the current vector, using angle and length values, instead of x and y

    Parameters

    • angle: number

      the new angle

    • length: number

      the new length

    Returns void