A simple Vector class
Usage:
- Initialize using Vec2.get()
var vec = Vec2.get(0, 0);
- Or with an array
var vec:Vec2 = [0, 1];
- Recycle vectors when you're done with them:
my_vector.put()
Variables
Methods
@:implinlinecross (this:Array<Float>):Float
@:implinlinedistance (this:Array<Float>):Float
@:implinlinedot (this:Array<Float>):Float
@:implinlineequals (this:Array<Float>):Bool
@:implinlinefacing (this:Array<Float>):Float
@:value({ y : 0, x : 0 })@:implinlineset (this:Array<Float>, x:Float = 0):Vec2
Static variables
@:value([0, 1])staticread onlyDOWN:Vec2 = [0, 1]
@:value([-1, 0])staticread onlyLEFT:Vec2 = [-1, 0]
@:value([1, 0])staticread onlyRIGHT:Vec2 = [1, 0]
@:value([0, -1])staticread onlyUP:Vec2 = [0, -1]
Static methods
@:value({ y : 0, x : 0 })staticget (x:Float = 0, y:Float = 0):Vec2