Matrix

Generic non-resizeable matrix with R rows and C columns. Intended for 3D use (size 3x3 and 4x4). Important: <b>Matrices here are in row-major order whereas OpenGL is column-major.</b>

struct Matrix (
T
int R
int C
) {}

Constructors

this
this(U values)
Undocumented in source.
this
this(T x)

Construct matrix with a scalar.

Members

Aliases

column_t
alias column_t = Vector!(T, R)
Undocumented in source.
rotateX
alias rotateX = rotateAxis!(1, 2)
rotateY
alias rotateY = rotateAxis!(2, 0)
rotateZ
alias rotateZ = rotateAxis!(0, 1)
row_t
alias row_t = Vector!(T, C)
Undocumented in source.

Functions

column
column_t column(int j)
frustum
Frustum!T frustum()

Extract frustum from a 4x4 matrice.

inverse
Matrix inverse()
inverse
Matrix inverse()
inverse
Matrix inverse()
opAssign
Matrix opAssign(U x)

Assign with a samey matrice.

opAssign
Matrix opAssign(U x)

Assign from other small matrices (same size, compatible type).

opAssign
Matrix opAssign(U x)

Assign with a static array of size R * C.

opAssign
Matrix opAssign(U x)

Assign with a dynamic array of size R * C.

opBinary
column_t opBinary(row_t x)

Matrix * vector multiplication.

opBinary
auto opBinary(U x)

Matrix * matrix multiplication.

opBinary
Matrix opBinary(U other)

Matrix add and substraction.

opCast
U opCast()

Cast to other matrix types. If the size are different, the resulting matrix is truncated and/or filled with identity coefficients.

opCast
U opCast()

Convert 3x3 rotation matrix to quaternion.

opCast
U opCast()

Converts a 4x4 rotation matrix to quaternion.

opEquals
bool opEquals(U other)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(U other)
Undocumented in source. Be warned that the author may not have intended to support it.
opOpAssign
Matrix opOpAssign(U operand)

Assignment operator with another samey matrix.

opOpAssign
Matrix opOpAssign(U operand)

Assignment operator with another samey matrix.

opUnary
Matrix opUnary()
Undocumented in source. Be warned that the author may not have intended to support it.
ptr
inout(T)* ptr()

Return a pointer to content.

row
row_t row(int i)
scale
void scale(Vector!(T, R - 1) v)

In-place matrix scaling.

toString
string toString()

Covnerts to pretty string.

translate
void translate(Vector!(T, R - 1) v)

In-place translate by (v, 1)

transposed
Matrix!(T, C, R) transposed()

Static functions

constant
Matrix constant(U x)
fromColumns
Matrix fromColumns(column_t[] columns)

Construct a matrix from columns.

fromRows
Matrix fromRows(row_t[] rows)

Construct a matrix from rows.

identity
Matrix identity()
lookAt
Matrix lookAt(vec3!T eye, vec3!T target, vec3!T up)
orthographic
Matrix orthographic(T left, T right, T bottom, T top, T near, T far)
perspective
Matrix perspective(T FOVInRadians, T aspect, T zNear, T zFar)
rotateAxis
Matrix rotateAxis(T angle)
Undocumented in source. Be warned that the author may not have intended to support it.
rotation
Matrix rotation(T angle, vec3!T axis)

Similar to the glRotate matrix, however the angle is expressed in radians

scaling
Matrix scaling(Vector!(T, R - 1) v)

Make a scaling matrix.

translation
Matrix translation(Vector!(T, R - 1) v)

Make a translation matrix.

Unions

__anonymous
union __anonymous
Undocumented in source.

Variables

isSquare
enum bool isSquare;
Undocumented in source.

Parameters

T

type of elements

R

number of rows

C

number of columns

Meta