Matrix.this

Constructs the matrix: If a single value is passed, the matrix will be cleared with this value (each column in each row will contain this value). If a matrix with more rows and columns is passed, the matrix will be the upper left nxm matrix. If a matrix with less rows and columns is passed, the passed matrix will be stored in the upper left of an identity matrix. It's also allowed to pass vectors and scalars at a time, but the vectors dimension must match the number of columns and align correctly.

  1. this(Args args)
  2. this(T mat)
  3. this(T mat)
    struct Matrix(type, int rows_, int cols_)
    @safe pure nothrow
    this
    (
    T
    )
    (
    T mat
    )
    if (
    is_matrix!T &&
    (T.cols < cols)
    &&
    (T.rows < rows)
    )
    if (
    (rows_ > 0) &&
    (cols_ > 0)
    )
  4. this(mt value)

Examples

mat2 m2 = mat2(0.0f); // mat2 m2 = mat2(0.0f, 0.0f, 0.0f, 0.0f);
mat3 m3 = mat3(m2); // mat3 m3 = mat3(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f);
mat3 m3_2 = mat3(vec3(1.0f, 2.0f, 3.0f), 4.0f, 5.0f, 6.0f, vec3(7.0f, 8.0f, 9.0f));
mat4 m4 = mat4.identity; // just an identity matrix
mat3 m3_3 = mat3(m4); // mat3 m3_3 = mat3.identity

Meta