Immutable 2D vector.

Implements

Constructors

Properties

x y

Accessors

Methods

Constructors

  • Constructor.

    Parameters

    • x: number

      The x component.

    • y: number

      The y component.

    Returns Vec2

Properties

x: number

The x component of the vector.

y: number

The y component of the vector.

Accessors

  • get nx(): Vec2
  • The negative x-axis vector.

    Returns Vec2

  • get ny(): Vec2
  • The negative y-axis vector.

    Returns Vec2

  • get one(): Vec2
  • The vector with all components set to one.

    Returns Vec2

  • get x(): Vec2
  • The x-axis vector.

    Returns Vec2

  • get y(): Vec2
  • The y-axis vector.

    Returns Vec2

  • get zero(): Vec2
  • The zero vector.

    Returns Vec2

Methods

  • The magnitude of the vector.

    Parameters

    Returns number

    The length of the vector.

  • The square of the magnitude of the vector.

    Parameters

    Returns number

    The length squared of the vector.

Generated using TypeDoc