Matrix.identity

Returns an identity matrix.

struct Matrix(T, ubyte R, ubyte C = R, MatrixOrder O = CurrentMatrixOrder)
static pure nothrow @safe @nogc
static if(O == MatrixOrder.RowMajor)
identity
()
if (
R >= 2 &&
R <= 4
&&
C >= 2
&&
C <= 4
)

Examples

auto matrix = Matrix!(uint, 3).identity();
assert (matrix.v == [1, 0, 0, /**/ 0, 1, 0, /**/ 0, 0, 1]);

Meta