Class: Vector2

Vector2

Primary Vector class. Uses Array type for axis storage.

new Vector2 (x, y)

Return a two-dimensional vector object.

Name Type Default Description
x Number 0

The x component of this Vector2

y Number 0

The y component of this Vector2

Members

x number

Default Value:
  • 0

y number

Default Value:
  • 0

Methods

Returns vector2 absolute.

Returns:
Type Description
Vector2

add (vector2)Vector2

Add the provided Vector to this one.

Name Type Description
vector2 Vector2

Anther vector2.

Returns:
Type Description
Vector2

cross (vector2)Number

Returns the cross product of this vector by another.

Name Type Default Description
vector2 Vector2 this optional

Anther vector2.

Returns:
Type Description
Number

dot (vector2)Number

Returns the dot product of this vector by another.

Name Type Default Description
vector2 Vector2 this optional

Anther vector2.

Returns:
Type Description
Number

max (value)Vector2

Returns a new vector2 so that each component of the new vector2 has a value greater
than or equal to the specified value.

Name Type Description
value Number

The specified value.

Returns:
Type Description
Vector2

min (value)Vector2

Returns a new vector2 so that the value of each component of the new vector2 is less
than or equal to the specified value.

Name Type Description
value Number

The specified value.

Returns:
Type Description
Vector2

mod ()Number

Returns vector2 mode.

Returns:
Type Description
Number

sub (vector2)Vector2

Subtract the provided vector from this one.

Name Type Description
vector2 Vector2

Anther vector2.

Returns:
Type Description
Vector2