Vector of three Float values x, y and z.

// constructing
var a = new Vec3(1, 2, 3.14);
var b:Vec3 = { x:1, y:2, z:2 };
var c:Vec3 = [ 1, 2, 3.14 ];

// access values
trace(a.z); // 3.14
a.y = 42;

trace( b.length ); // 3

.length calculates the current vector-length (same by casting the vector to a Float).

Operations:

+, - between two vectors results in a new Vec3, while * (dot product) results in a Float.
* and / between a Vec3 and a Float results in a new (stretched or compressed) Vec3.

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

staticx:Float

staticy:Float

staticz:Float

staticread onlylength:Float

Gets the current vector-length

staticread onlycopy:Vec3

A new vector instance with the same values.

Static methods

staticinlineisEqual(this:Vec3Impl, v:Vec3):Bool

Compare this to another vector of equality.

Parameters:

v

Vec3

staticinlinecopyFrom(this:Vec3Impl, v:Vec3):Vec3

Copyes the values of another inside this vector and returns its reference.

staticinlinenegate(this:Vec3Impl):Vec3

Negates the values of this vector and returns its reference.

staticinlinenormalize(this:Vec3Impl):Vec3

Normalizes the values of this vector and returns its reference.

staticinlinecrossProduct(this:Vec3Impl, v:Vec3):Vec3

Calculates the cross product.

Parameters:

v

Vec3

staticinlineadd(this:Vec3Impl, v:Vec3):Vec3

Adds the values of another vector to this vector.

staticinlinesubtract(this:Vec3Impl, v:Vec3):Vec3

Subtracts the values of another vector from this vector.

staticinlinemul(this:Vec3Impl, f:Float):Vec3

Multiplicates the values of this vector by a Float

staticinlinediv(this:Vec3Impl, f:Float):Vec3

Divides the values of this vector by a Float