Matrix

Matrix type

struct Matrix (
T
uint U
uint V
) if (
__traits(isArithmetic, T)
) {}

Constructors

this
this(T e)

Constructor by element type. This matrix's each element is filled by given value.

this
this(T[U * V] elements)

Constructor by array. This matrix's all elements are filled by given array.

this
this(Range r)

Constructor by InputRange. This matrix's all elements are filled by given range.

this
this(T[U][V] elements)

Constructor by array of array. This matrix's all elements are filled by given array.

this
this(Vector!(T, U)[V] vectors)

Constructor by array of vector. This matrix's all elements are filled by given Each vectors are dealed as column.

Alias This

array

Members

Aliases

ElementType
alias ElementType = T

Element type of this matrix type

Functions

array
T[U * V] array()

Get raw array data.

column
Vector!(T, U)[V] column()

Get column array as array of vector

opBinary
Matrix!(CommonType!(T, S), U, V) opBinary(Matrix!(S, U, V) m)

Binary operator between the same size matrix ("+" or "-"). Another type matrix is allowed.

opBinary
Matrix!(CommonType!(T, S), U, P) opBinary(Matrix!(S, V, P) m)

Multiply operator between matrix. Another type matrix is allowed.

opBinary
Matrix!(CommonType!(T, S), U, V) opBinary(S e)

Binary operation between scalar type ("*" or "/").

opBinary
Vector!(CommonType!(T, S), U) opBinary(Vector!(S, V) v)

Binary operation between vector type ("*" only).

opIndex
T opIndex(size_t i, size_t j)

indexing operation

opIndex
T opIndex(size_t i, size_t j)

indexing operation

opOpAssign
Matrix opOpAssign(Matrix!(S, U, V) m)

operator assign between matrix type ("+" or "-")

opOpAssign
Matrix opOpAssign(Matrix!(S, U, V) m)

operator assign between matrix type (only "*")

opOpAssign
Matrix opOpAssign(S e)

operator assign between scalar type ("*" or "/")

opUnary
Matrix!(T, U, V) opUnary()

Unary operation for "+".

opUnary
Matrix!(T, U, V) opUnary()

Unary operation for "-".

row
Vector!(T, V)[U] row()

Get row array as array of vector

toString
string toString()

Converts to string

Manifest constants

Column
enum Column;

Column number of this matrix type

Row
enum Row;

Row number of this matrix type

Static functions

axisAngle
Matrix axisAngle(Vector!(T, 3) axis, Angle angle)

Returns rotation matrix decided by its rotation axis and angle.

axisAngle
Matrix axisAngle(Vector!(T, 3) v, Angle angle)

Returns rotation matrix decided by its rotation axis and angle.

identity
Matrix identity()

Returns identity matrix.

lookAt
Matrix lookAt(Vector!(T, 3) vec, Vector!(T, 3) up)

Returns view transform matrix.

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

Returns view transform matrix.

makeInvertTRS
Matrix makeInvertTRS(Vector!(T, 3) pos, Matrix!(T, 3, 3) rot, Vector!(T, 3) scale)

Returns inverse TRS transform matrix.

makeTRS
Matrix makeTRS(Vector!(T, 3) trans, Matrix!(T, 3, 3) rot, Vector!(T, 3) scale)

Returns TRS transform matrix.

ortho
Matrix ortho(T width, T height, T nearZ, T farZ)

Returns orthographic projection transform matrix.

perspective
Matrix perspective(T aspectWperH, Angle fovy, T nearZ, T farZ)

Returns perspective projection transform matrix.

rotFromTo
Matrix rotFromTo(Vector!(T, 3) from, Vector!(T, 3) to)

Returns rotation matrix which converts a vector to another vector.

rotFromTo
Matrix rotFromTo(Vector!(T, 3) from, Vector!(T, 3) to)

Returns rotation matrix which converts a vector to another vector.

scale
Matrix scale(Vector!(T, U) vec)

Returns scale matrix.

translate
Matrix translate(Vector!(T, U - 1) vec)

Returns translation matrix.

Meta