Add value to the x component
Add value to the y component
Get the angle of rotation of the vector
return angle in degrees instead of radians
angle in radians, or in degrees if degrees param is true
Get the angle between two vectors
return angle in degrees instead of radians
angle in radians, or in degrees if degrees param is true
Create a new vector using x and y components of the vector
new Vector instance
The cross product of 2D vectors results in a 3D vector with only a z component.
the magnitude of the z value
Get the Euclidean distance between two vectors
Get the square of the Euclidean distance between two vectors.
Divide the x component by a scalar
Divide the y component by a scalar
Calculate the dot product
Compare x and y components with another vector
true if x and y components are equal, false otherwise
Get the magnitude of the vector
Get the square of the magnitude of the vector.
Limit the magnitude of the vector
Limit the x component of the vector
Limit the y component of the vector
Multiple the x component by a scalar
Multiple the y component by a scalar
Compare x and y components with another vector
false if x and y components are equal, true otherwise
Call .toString() and print the output to the console
Randomize x and y components of the vector
min random value
max random value
Randomize x component of the vector
min random value
max random value
Randomize y component of the vector
min random value
max random value
Set x and y components to 0
Rotate the vector by an angle
angle in radians, or in degrees if degrees param is true
use degrees instead of radians
Set a magnitude of the vector
Set the x component of the vector
Set the y component of the vector
Subtract value from the x component
Subtract value from the y component
Convert the vector to array
Convert the vector to JSON
Convert the vector to object
Convert the vector to string
Normalize the vector https://en.wikipedia.org/wiki/Unit_vector
Create a new vector
Create a new vector from a tuple
Create a new vector with random x and y components
min random value
max random value
Create a new vector with 0,0 x and y components
Generated using TypeDoc