Vec2
A two dimensional vector.
Properties
x- doubley- double
Methods
Vec2:new(x, y)
Vec2:new(x, y)x- What to set x toy- What to set y to
Constructs a new Vec2 with the provided x and y.
Example:
length()
length()Returns the length of the Vec2
Example:
distanceTo(otherVec2)
distanceTo(otherVec2)otherVec2- A different Vec2
Returns the distance from this vector to the otherVec2
Example:
angleTo(otherVec2)
angleTo(otherVec2)otherVec2- A different Vec2
Returns the angle to the otherVec2
Example:
normalized()
normalized()Returns this vector but normalized (that is with length 1)
Example:
scale(scalar)
scale(scalar)scalar- By how much you want to scale the vector
Returns a scaled version of this vector
Example:
toString()
toString()Returns a string representation of the Vec2
Example:
Last updated