X component of the Vector
Y component of the Vector
The size (magnitude) of the Vector
Setting the size mutates the current vector
Get the x component of the vector
Set the x component, THIS MUTATES the current vector. It is usually better to create a new vector.
Get the y component of the vector
Set the y component, THIS MUTATES the current vector. It is usually better to create a new vector.
A unit vector pointing down (0, 1)
A (0.5, 0.5) vector
A unit vector pointing left (-1, 0)
A (1, 1) vector
A unit vector pointing right (1, 0)
A unit vector pointing up (0, -1)
A (0, 0) vector
Creates new vector that has the same values as the previous.
Performs a 2D cross product with scalar. 2D cross products with a scalar return a vector.
The scalar to cross
Performs a 2D cross product with another vector. 2D cross products return a scalar value not a vector.
The vector to cross
The distance to another vector. If no other Vector is specified, this will return the [[magnitude]].
The other vector. Leave blank to use origin vector.
Performs a dot product with another vector
The vector to dot
Compares this point against another and tests for equality
The other point to compare to
Amount of euclidean distance off we are willing to tolerate
Negate the current vector
Returns the normal vector to this one, same as the perpendicular of length 1
Normalizes a vector to have a magnitude of 1.
Returns the perpendicular vector to this one
Scales this vector by a factor of size and modifies the original
Sets the x and y components at once, THIS MUTATES the current vector. It is usually better to create a new vector.
Returns the angle of this vector.
Returns a string representation of the vector.
Returns a vector of unit length in the direction of the specified angle in Radians.
The angle to generate the vector
Checks if vector is not null, undefined, or if any of its components are NaN or Infinity.
A 2D vector on a plane.