The first component of the vector.
The second component of the vector.
Static
Readonly
DOWNA constant vector set to [0, -1].
Static
Readonly
LEFTA constant vector set to [-1, 0].
Static
Readonly
ONEA constant vector set to [1, 1].
Static
Readonly
RIGHTA constant vector set to [1, 0].
Static
Readonly
UPA constant vector set to [0, 1].
Static
Readonly
ZEROA constant vector set to [0, 0].
Returns the shortest Euler angle between two 2-dimensional vectors.
The 2-dimensional vector to calculate angle to.
The shortest angle in degrees between two 2-dimensional vectors.
Returns the result of a cross product operation performed on the two specified 2-dimensional vectors.
The second 2-dimensional vector operand of the cross product.
The cross product of the two vectors.
Returns the distance between the two specified 2-dimensional vectors.
The second 2-dimensional vector to test.
The distance between the two vectors.
Returns the result of a dot product operation performed on the two specified 2-dimensional vectors.
The second 2-dimensional vector operand of the dot product.
The result of the dot product operation.
Reports whether two vectors are equal.
The vector to compare to the specified vector.
True if the vectors are equal and false otherwise.
Reports whether two vectors are equal using an absolute error tolerance.
The vector to be compared against.
Optional
epsilon: number = 1e-6The maximum difference between each component of the two vectors. Defaults to 1e-6.
True if the vectors are equal and false otherwise.
Returns the result of a linear interpolation between two specified 2-dimensional vectors.
The 2-dimensional to interpolate from.
The 2-dimensional to interpolate to.
The value controlling the point of interpolation. Between 0 and 1, the linear interpolant will occur on a straight line between lhs and rhs. Outside of this range, the linear interpolant will occur on a ray extrapolated from this line.
Self for chaining.
Returns this 2-dimensional vector converted to a unit vector in place. If the vector has a length of zero, the vector's elements will be set to zero.
Optional
src: Vec2 = ...The vector to normalize. If not set, the operation is done in place.
Self for chaining.
A 2-dimensional vector.