Matrix4 is a 4x4 matrix, useful for 3D calculations

Static variables

staticread onlydeterminant:Float

Gets the determinant of the matrix

staticposition:Vector4

Gets or sets the position value of this matrix

Static methods

staticappend(this:Float32Array, lhs:Matrix4):Void

Appends a second matrix by multiplying its values against the current one

Parameters:

lhs

A second matrix instance

@:value({ pivotPoint : null })staticappendRotation(this:Float32Array, degrees:Float, axis:Vector4, ?pivotPoint:Vector4):Void

Appends rotation to the current matrix

Parameters:

degrees

A rotation value (in degrees)

axis

The coordinate position of the rotation axis

pivotPoint

(Optional) A pivot point to use in the rotation

staticappendScale(this:Float32Array, xScale:Float, yScale:Float, zScale:Float):Void

Appends a scale value to the current matrix

Parameters:

xScale

The x scale to append

yScale

The y scale to append

zScale

The z scale to append

staticappendTranslation(this:Float32Array, x:Float, y:Float, z:Float):Void

Increases the position/translation of the current matrix

Parameters:

x

The x amount to offset the current position

y

The y amount to offset the current position

z

The z amount to offset the current position

staticclone(this:Float32Array):Matrix4

Creates a duplicate of the current Matrix4

Returns:

A new Matrix4 with the same values as the current matrix

staticcopyColumnFrom(this:Float32Array, column:Int, vector:Vector4):Void

Copies a column of data from a Vector4 instance into the values of this matrix

Parameters:

column

The column to copy into (0, 1, 2 or 3)

vector

The Vector4 copy from

staticcopyColumnTo(this:Float32Array, column:Int, vector:Vector4):Void

Copies a column of data from the current matrix into a Vector4 instance

Parameters:

column

The column to copy (0, 1, 2 or 3)

vector

The Vector4 copy to

staticcopyFrom(this:Float32Array, other:Matrix4):Void

Copies the values of another Matrix4 into the current matrix

Parameters:

other

A Matrix4 instance to copy from

staticcopyRowFrom(this:Float32Array, row:Int, vector:Vector4):Void

Copies a row of data from a Vector4 instance into the values of this matrix

Parameters:

row

The row to copy into (0, 1, 2 or 3)

vector

The Vector4 copy from

staticcopyRowTo(this:Float32Array, row:Int, vector:Vector4):Void

Copies a row of data from the current matrix into a Vector4 instance

Parameters:

column

The row to copy (0, 1, 2 or 3)

vector

The Vector4 copy to

@:value({ ty : 0, tx : 0 })staticcreate2D(this:Float32Array, a:Float, b:Float, c:Float, d:Float, tx:Float = 0, ty:Float = 0):Void

Resets the current matrix using two-dimensional transform values

Parameters:

a

A two-dimensional matrix a value

b

A two-dimensional matrix b value

c

A two-dimensional matrix c value

d

A two-dimensional matrix d value

tx

(Optional) A two-dimensional matrix tx value (default is 0)

ty

(Optional) A two-dimensional matrix ty value (default is 0)

staticcreateOrtho(this:Float32Array, left:Float, right:Float, bottom:Float, top:Float, zNear:Float, zFar:Float):Void

Initializes this matrix with values for an orthographic projection, useful in rendering

Parameters:

left

The left (or x0) coordinate for the projection

right

The right (or x1) coordinate for the projection

bottom

The bottom (or y0) coordinate for the projection

top

The top (or y1) coordinate for the projection

zNear

The near depth-clipping plane position

zFar

The far depth-clipping plane position

staticcreatePerspective(this:Float32Array, fov:Float, aspect:Float, zNear:Float, zFar:Float):Void

Initializes this matrix with values for a perspective projection

Parameters:

fov

The field of view

aspect

The aspect ratio

zNear

The near depth-clipping plane position

zFar

The far depth-clipping plane position

@:value({ result : null })staticdeltaTransformVector(this:Float32Array, v:Vector4, ?result:Vector4):Vector4

Returns the transformation matrix's translation, rotation, and scale settings as a Vector of three Vector4 objects.

@:fromstaticfromMatrix3(matrix3:Matrix3):Matrix4

staticidentity(this:Float32Array):Void

Resets the current matrix using default identity values

@:value({ result : null })staticinterpolate(thisMat:Matrix4, toMat:Matrix4, percent:Float, ?result:Matrix4):Matrix4

Interpolates from one Matrix4 instance to another, given a percentage between the two

Parameters:

thisMat

The first Matrix4 object to start from

toMat

The second Matrix4 object to interpolate toward

percent

The percentage value to interpolate by

result

(Optional) A Matrix4 instance to use when returning the result

Returns:

A Matrix4 with the resulting value

staticinterpolateTo(this:Float32Array, toMat:Matrix4, percent:Float):Void

Interpolates the current matrix toward another matrix, resetting the values of the current matrix

Parameters:

toMat

The second Matrix4 object to interpolate toward

percetn

The percentage value to interpolate by

staticinvert(this:Float32Array):Bool

Attempts to invert the current matrix, so long as the determinant is greater than zero

Returns:

Whether the invert operation was successful

@:value({ up : null, at : null })staticpointAt(this:Float32Array, pos:Vector4, ?at:Vector4, ?up:Vector4):Void

Sets the matrix values as a transformation orientated toward a certain vector position

Parameters:

pos

A target vector position in absolute coordinates

at

(Optional) A vector relative to this matrix which defines the current direction

up

(Optional) A vector relative to this matrix which defines the "up" direction

staticprepend(this:Float32Array, rhs:Matrix4):Void

Prepends a right-hand matrix to the current matrix

Parameters:

rhx

A right-hand Matrix4 to append

@:value({ pivotPoint : null })staticprependRotation(this:Float32Array, degrees:Float, axis:Vector4, ?pivotPoint:Vector4):Void

Prepends rotation to this matrix

Parameters:

degrees

The rotation amount in degrees

axis

The rotation axis

pivotPoint

(Optional) A pivot point for the rotation

staticprependScale(this:Float32Array, xScale:Float, yScale:Float, zScale:Float):Void

Prepends scale to this matrix

Parameters:

xScale

An x scale value

yScale

A y scale value

zScale

A z scale value

staticprependTranslation(this:Float32Array, x:Float, y:Float, z:Float):Void

Prepends translation values to this matrix

Parameters:

x

An x translation value

y

A y translation value

z

A z translation value

@:value({ result : null })statictransformVector(this:Float32Array, v:Vector4, ?result:Vector4):Vector4

Transforms a Vector4 instance using the current matrix

Parameters:

result

(Optional) An existing Vector2 instance to fill with the result

Returns:

The resulting Vector4 instance

statictransformVectors(this:Float32Array, ain:Float32Array, aout:Float32Array):Void

Transforms a series of [x, y, z] value pairs at once

Parameters:

ain

An input Float32Array to transform

aout

An output Float32Array to write to

statictranspose(this:Float32Array):Void

Transposes the current matrix