The Vector2
class can be used for calculating math with
basic (x, y) coordinates
Static methods
staticinterpolate(pt1:Vector2, pt2:Vector2, f:Float, ?result:Vector2):Vector2
Constructor
new(x:Float = 0, y:Float = 0)
Creates a new Vector
instance
Parameters:
x | (Optional) An initial |
---|---|
y | (Optional) An initial |
Variables
read onlylengthSquared:Float
Gets the square of the length of this vector, which
avoids use of Math.sqrt
for faster performance
Methods
normalize(thickness:Float):Void
Normalizes this vector between the current length and a set scale value
Parameters:
thickness | The scaling value. . For example, if the current vector is |
---|
offset(dx:Float, dy:Float):Void
Offsets the current value of this vector
Parameters:
dx | An offset x value |
---|---|
dy | An offset y value |