The 'x' component of the vector
The 'y' component of the vector
The 'x' component of the vector
The 'y' component of the vector
Get the angle in radians of this vector (relative to the origin)
Get the length of this vector
Get the square of the length of this vector
Get the 'x' component of this vector
Get the 'y' component of this vector
Get a vector that is normal (counter-clockwise perpendicular) to this vector (with the same length as this vector)
Scale the components of this vector by a scalar and return the result as a new vector (without modifying this vector)
Get a unit vector for this vector
Add the components of another vector to this vector and store the result in the original vector
The other vector
Calculate a normal vector (counter-clockwise perpendicular) to this vector (with the same length as this vector) and store the result in the original vector
Scale the components of this vector by a scalar and store the result in the original vector
Subtract the components of another vector from this vector and store the result in the original vector
The other vector
Calculate the unit vector to this vector and store the result in the original vector
Get the angle of another vector from this vector
The other vector
Get the cross product of this vector and another vector. Assuming the cross product of two 2D vectors is, U x V = Ux * Vy - Uy * Vx.
The other vector
Get the scalar distance of this vector from another vector
The other vector
Get the square of the scalar distance of this vector from another vector
The other vector
Get the dot product of this vector and another vector
The other vector
Set the angle (in radians) of this vector without modifying the length
The angle (in radians) to set this vector to
Set the 'x' and 'y' components of this vector to the specified values
The value that the 'x' component will be set to
The value that the 'y' component will be set to
Set the components of this vector based on the components of another vector
The other vector
Set the length of this vector without modifying the angle
The length to set this vector to
Set the components of this vector to zero
Set the 'x' component of the vector
The value that the 'x' component will be set to
Set the 'y' component of the vector
The value that the 'y' component will be set to
Returns a copy of this vector as a new vector
Check if this vector has the same 'x' and 'y' components as another vector
The other vector
Checks whether this vector is zero (ie the 'x' and 'y' components are equal to zero)
Returns a JSON representation of this vector in the form {"x": x-component, "y": y-component}
Returns a string representation of this vector in the form "(x-component, y-component)"
Generated using TypeDoc
The 2D vector class.