Vector of two Float values x and y.
// constructing
var a = new Vec2(2, 3.14);
var b:Vec2 = { x:3, y:4 };
var c:Vec2 = [ 1, 3.14 ];
// access values
trace(a.y); // 3.14
a.x = 42;
trace( b.length ); // 5
.length calculates the current vector-length (same by casting the vector to a Float).
Operations:
+, - between two vectors results in a new Vec2, while * (dot product) results in a Float.
* and / between a Vec2 and a Float results in a new (stretched or compressed) Vec2.
Comparing vectors:
>, <, >=, <= results into comparing the lengths of the vectors.
a.isEqual(b) can be used to compare two vectors a and b for value-equality.
Static variables
Static methods
staticinlinecopyFrom(this:Vec2Impl, v:Vec2):Vec2
Copyes the values of another inside this vector and returns its reference.
staticinlinenormalize(this:Vec2Impl):Vec2
Normalizes the values of this vector and returns its reference.