Degrees relativ to X axis.
Length.
Squared length.
Get greater of x or y.
Get lesser of x or y.
Radians relativ to X axis.
Set both x and y.
Add components.
Optionaly: numberSelf
Ceil all components.
Self
Clamp all components.
Min
Max
Self
Clamp x and y separately.
Min X
Min Y
Max X
Max Y
Self
Copy components into a typed array.
Typed array
Element offset
Cross product.
Optionaly: numberCross product
Get angle between this and (x, y) from origin.
Optionaly: numberAngle in degrees
Get angle of the vector between this and (x, y).
Optionaly: numberAngle in degrees
Divide by components.
Optionaly: numberMake this vector the result of (x, y) / this vector.
Optionaly: numberSelf
Dot product.
Optionaly: numberDot product.
Check equality of components.
Tolerance
true if equal within tolerance
Check equality of vectors.
Optionalepsilon: numberTolerance
true if equal within tolerance
Floor all components.
Self
Make all components absolute.
Self
Make this vector the direction vector between this and (x, y).
Optionaly: numberSelf
Multiply components.
Optionaly: numberSelf
Normalize.
Self
Project this vector onto the vector defined by x and y.
X
Optionaly: numberY
Self
Get angle between this and (x, y) from origin.
Optionaly: numberAngle in radians
Get angle of the vector between this and (x, y).
Optionaly: numberAngle in radians
Rotate this vector around a point.
Amount to rotate in degrees
Optionalcx: numberCenter x
Optionalcy: numberCenter y
Self
Rotate this vector around a point.
Amount to rotate in radians
Center
Self
Rotate this vector around a point.
Amount to rotate in radians
Optionalcx: numberCenter x
Optionalcy: numberCenter y
Self
Rotate this vector around a point.
Amount to rotate in radians
Center
Self
Round all components.
Self
Set components.
X value
Optionaly: numberY value, uses x if omitted
Self
Subtract components.
Optionaly: numberSelf
Make this vector the result of (x, y) - this vector.
Optionaly: numberSelf
Returns a string representation of an object.
StaticfromStaticoneStaticzero
Two-dimensional vector (point).
Methods (like Vec2.multiply, Vec2.add) generally mutate the instance. Create new instances with Vec2.clone.