Matrix4x4

A Matrix is a structure which may describe different transformation. Note: Matrix4x4.init is the identity Matrix.

Constructors

this
this(float a, float b, float c, float d, float e, float f, float g, float h, float i)

CTor

Members

Functions

det
float det()

Calculate the determinant

getInverse
Matrix4x4 getInverse()

Returns the inverse Matrix of the current. If the current matrix has a determinant of approximately zero, the identity Matrix (.init) is returned.

getValues
inout(float[16]) getValues()

Returns the 16 values of the Matrix by ref

loadIdentity
Matrix4x4 loadIdentity()

Reset the current Matrix to the identity Matrix

lookAt
void lookAt(Vector3f eye, Vector3f look, Vector3f up)

Calculates a View-Matrix

opBinary
Matrix4x4 opBinary(Matrix4x4 mat)

Supported operations: only *

opEquals
bool opEquals(Matrix4x4 mat)

Compares two Matrices approximately

opIndex
inout(float) opIndex(ubyte index)

Returns a specific value by index

opOpAssign
Matrix4x4 opOpAssign(Matrix4x4 math)

Supported operations: only *=

ortho
bool ortho(Rect rect, float zNear, float zFar)

Calculate a prthographic projection

perspective
void perspective(float fov, float ratio, float nearp, float farp)

Calculate a perspective projection

rotate
Matrix4x4 rotate(float angle)

Rotate the Matrix about angle (in degree!)

rotate
Matrix4x4 rotate(float angle, Vector2f center)

Rotate the Matrix about angle (in degree!) about the given center position

scale
Matrix4x4 scale(Vector2f scale)

Scale the Matrix about factor scale

scale
Matrix4x4 scale(Vector2f scale, Vector2f center)

Scale the Matrix about factor scale about the given center position

translate
Matrix4x4 translate(Vector2f vec)

Translate the Matrix

Meta

Authors

Randy Schuett (rswhite4@googlemail.com)