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

Static methods

@:fromstaticfromMatrix3(matrix3:Matrix3):Matrix4

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

Variables

@:implread onlydeterminant:Float

Gets the determinant of the matrix

@:implposition:Vector4

Gets or sets the position value of this matrix

Methods

@:implappend(lhs:Matrix4):Void

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

Parameters:

lhs

A second matrix instance

@:value({ pivotPoint : null })@:implappendRotation(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

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

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

@:implclone():Matrix4

Creates a duplicate of the current Matrix4

Returns:

A new Matrix4 with the same values as the current matrix

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

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

@:implcopyFrom(other:Matrix4):Void

Copies the values of another Matrix4 into the current matrix

Parameters:

other

A Matrix4 instance to copy from

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

@:implcopyRowTo(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 })@:implcreate2D(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)

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

@:value({ result : null })@:impldeltaTransformVector(v:Vector4, ?result:Vector4):Vector4

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

@:implidentity():Void

Resets the current matrix using default identity values

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

@:implinvert():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 })@:implpointAt(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

@:implprepend(rhs:Matrix4):Void

Prepends a right-hand matrix to the current matrix

Parameters:

rhx

A right-hand Matrix4 to append

@:value({ pivotPoint : null })@:implprependRotation(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

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

@:implprependTranslation(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 })@:impltransformVector(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

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

@:impltranspose():Void

Transposes the current matrix