Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Vector2

Represents 2D points and vectors.

Hierarchy

  • Vector2

Index

Constructors

  • Returns Vector2

  • Parameters

    • x: number
    • y: number

    Returns Vector2

Properties

length: number

Returns the length of this vector.

The length is calculated by the square root of (x * x + y * y)

returns

length of this vector.

normalized: Vector2

Returns a copy of this vector with length 1.

sqrLength: number

Returns the squared length of this vector.

If you use vector lengths to compare distances, squared lengths are more performant and preferred to use.

returns

squared length of this vector

x: number
y: number