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

@:implangle:Float

@:impllength:Float

@:implx:Float

@:imply:Float

Methods

@:implinlinecopy ():Vec2

@:implinlinecopy_from (this:Array<Float>):Vec2

@: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

@:implinlinenormalize ():Vec2

@:implinlineput ():Void

@:implinlinescale (this:Array<Float>):Vec2

@:value({ y : 0, x : 0 })@:implinlineset (this:Array<Float>, x:Float = 0):Vec2

@:implinlinetoString ():String

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