Options
All
  • Public
  • Public/Protected
  • All
Menu

This class represents a twodimensional real Vector

export

Hierarchy

  • Vector2

Index

Constructors

constructor

  • new Vector2(x: number, y: number): Vector2
  • Creates an instance of Vector2 with given coordinates.

    memberof

    Vector2

    Parameters

    • x: number
    • y: number

    Returns Vector2

Properties

x

x: number

The x coordinate

memberof

Vector2

y

y: number

The y coordinate

memberof

Vector2

Methods

add

  • Returns a new Vector calculated by adding the given vector v to the current one.

    memberof

    Vector2

    Parameters

    Returns Vector2

distance

  • Calculates the distance between this vector another one given as parameter.

    memberof

    Vector2

    Parameters

    Returns number

length

  • length(): number
  • Returns the length of the current vector.

    memberof

    Vector2

    Returns number

multiply

  • Returns a new vector with the coordinates multiplied by the parameter s.

    memberof

    Vector2

    Parameters

    • s: number

    Returns Vector2

normalised

  • Returns the normalised vector.

    Returns Vector2

substract

  • Returns a new Vector calculated by subtracting the given vector v from the current one.

    memberof

    Vector2

    Parameters

    Returns Vector2

transform

  • Calculates a new Vector by multiplying a Matrix with the current vector.

    If x is the current vector and mat is A the resulting vector t is:

    Ax = t

    memberof

    Vector2

    Parameters

    Returns Vector2

Static Zero

  • Returns a new instance with all components set to zero.

    static
    memberof

    Vector2

    Returns Vector2

Generated using TypeDoc