Matrix

T = Type of elements. R = Number of rows. C = Number of columns. O = Matrix order. It can be RowMajor or ColumnMajor.

struct Matrix (
T
ubyte R
ubyte C = R
MatrixOrder O = CurrentMatrixOrder
) if (
R >= 2 &&
R <= 4
&&
C >= 2
&&
C <= 4
) {}

Constructors

this
this(U values)

Members

Aliases

ColumnType
alias ColumnType = Vector!(T, R)
RowType
alias RowType = Vector!(T, C)
rotateXAxix
alias rotateXAxix = rotateAxis!(1, 2)

Returns rotation matrix along axis X.

rotateYAxis
alias rotateYAxis = rotateAxis!(2, 0)

Returns rotation matrix along axis Y.

rotateZAxis
alias rotateZAxis = rotateAxis!(0, 1)

Returns rotation matrix along axis Z.

type
alias type = T

Functions

column
ColumnType column(int j)
inverse
Matrix inverse()

Returns inverse of matrix 2x2.

inverse
Matrix inverse()

Returns inverse of matrix 3x3.

inverse
Matrix inverse()

Returns inverse of matrix 4x4.

opBinary
Matrix opBinary(T factor)
opBinary
ColumnType opBinary(RowType x)
opBinary
auto opBinary(U x)
opBinary
Matrix opBinary(U rhs)
opCast
U opCast()
opEquals
bool opEquals(U rhs)
opOpAssign
Matrix opOpAssign(U rhs)
opUnary
Matrix opUnary()
ptr
inout(T)* ptr()

Returns a pointer to content.

rotate
void rotate(T angle, Vector!(T, 3) axis)

In-place rotation by (v, 1)

rotateX
void rotateX(T angle)
rotateY
void rotateY(T angle)
rotateZ
void rotateZ(T angle)
scale
void scale(Vector!(T, R - 1) v)

In-place matrix scaling.

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

In-place translate by (v, 1).

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

Returns transposed matrix.

Manifest constants

columnCount
enum columnCount;
order
enum order;
rowCount
enum rowCount;

Static functions

constant
Matrix constant(U x)

Returns a constant matrix.

diag
Matrix diag(Vector!(T, R) v)

Makes a diagonal matrix from a vector.

fromColumns
Matrix fromColumns(ColumnType[] columns)

Construct a matrix from columns.

fromRows
Matrix fromRows(RowType[] rows)

Construct a matrix from rows.

identity
Matrix identity()

Returns an identity matrix.

lookAt
Matrix lookAt(Vector!(T, 3) eye, Vector!(T, 3) target, Vector!(T, 3) up)

Returns lookAt projection.

orthographic
Matrix orthographic(T left, T right, T bottom, T top, T near, T far)

Returns orthographic projection.

perspective
Matrix perspective(T FOVInRadians, T aspect, T zNear, T zFar)

Returns perspective projection.

rotateAxis
Matrix rotateAxis(T angle)
rotation
Matrix rotation(T angle, Vector!(T, 3) axis, Matrix m)
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

Fields definition.

Variables

isSquare
enum bool isSquare;

Meta