Bidimentional Vector

Constructors

Properties

x: number = 0
y: number = 0

Accessors

Methods

  • Computes the dot product between this vector and another one

    Parameters

    • other: Vec2

      the other vector to use for the computation

    Returns number

    the dot product between the vectors

  • Multiplies this vector in place by a scalar value.

    Parameters

    • scalar: number

    Returns Vec2

    Chainable this

  • Reflects this vector in place with respect to a given normal.

    Parameters

    Returns Vec2

    Chainable this

  • Constructs a new vec2 from another one.

    Parameters

    • other: Vec2

      the other vec2 to construct a new one from

    Returns Vec2

    a new vec2