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
) 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 fprimitive)
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)
setScale
void setScale(Vector3!T scale)
Undocumented in source.
setTranslation
void setTranslation(Vector3!T translation)
Undocumented in source.
transposed
Matrix!(T, C, R) transposed()

Returns transposed matrix.

Manifest constants

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

Static functions

camera
Matrix camera(Vector!(T, 3) forward, Vector!(T, 3) up)

Returns camera projection

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.

perspective
Matrix perspective(T FOVInRadians, T width, T height, 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.

transformation
Vector4!T transformation(Matrix lhs, Vector4!T rhs)

* Transform a Vector4 by a Matrix4.

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

Make a translation matrix.

Unions

__anonymous
union __anonymous

Fields definition.

Variables

isSquare
enum bool isSquare;

Meta