Readonly
is0
0
Adds the multiple of v and s to this vector.
Multiplies this vector (with an implicit 1 as the 3rd component) by m.
If this vector's length is greater than the max value, it is replaced by the max value. If this vector's length is less than the min value, it is replaced by the min value.
the minimum value the length will be clamped to.
the maximum value the length will be clamped to.
If this vector's x or y values are greater than the max value, they are replaced by the max value. If this vector's x or y values are less than the min value, they are replaced by the min value.
the minimum value the components will be clamped to.
the maximum value the components will be clamped to.
Copies value of v to this vector.
Computes cross product of this vector and v.
Computes distance of this vector to v.
Use .manhattanDistanceTo() instead.
Computes squared distance of this vector to v.
Divides this vector by v.
Computes dot product of this vector and v.
Checks for strict equality of this vector and v.
Sets this vector's x and y values from the attribute.
the source attribute.
index in the attribute.
Use .manhattanLength() instead.
Linearly interpolates between this vector and v, where alpha is the distance along the line - alpha = 0 will be this vector, and alpha = 1 will be v.
vector to interpolate towards.
interpolation factor in the closed interval [0, 1].
Computes the Manhattan length (distance) from this vector to the given vector v
see Taxicab Geometry
Computes the Manhattan length of this vector.
see Taxicab Geometry
If this vector's x or y value is less than v's x or y value, replace that value with the corresponding max value.
If this vector's x or y value is greater than v's x or y value, replace that value with the corresponding min value.
Multiplies this vector by v.
Rotates the vector around center by angle radians.
the point around which to rotate.
the angle to rotate, in radians.
Subtracts v from this vector.
Returns an array [x, y], or copies x and y into the provided array.
Optional
array: number[](optional) array to store the vector to. If this is not provided, a new array will be created.
Optional
offset: number(optional) optional offset into the array.
The created or provided array.
Optional
array: Vector2TupleOptional
offset: 0Copies x and y into the provided array-like.
array-like to store the vector to.
Optional
offset: number(optional) optional offset into the array.
The provided array-like.
2D vector.
( class Vector2 implements Vector )