.. _std_math_matrix: .. highlight:: d std.math.matrix --------------- .. c:namespace:: std.math.matrix Module entries: :class:`mat4x4` .. class:: mat4x4 This data type represents a 4x4 row-major matrix. The implementations for various matrix operations are effectively copy-pasted from the OpenGL manpages. .. method:: rotateX(by) `mat4x4 rotateX(float by)` Add a rotation around X by `by` in radians. .. method:: rotateY(by) `mat4x4 rotateY(float by)` Add a rotation around Y by `by` in radians. .. method:: rotateZ(by) `mat4x4 rotateZ(float by)` Add a rotation around Z by `by` in radians. .. method:: scale(x, y, z) `mat4x4 scale(float x, float y, float z)` Scale the matrix in three dimensions. .. method:: translate(x, y, z) `mat4x4 translate(float x, float y, float z)` Translate the matrix. .. method:: mul(other) `mat4x4 mul(mat4x4 other)` Multiply with another matrix. .. method:: transform(vec) `vec4f transform(vec4f vec)` .. method:: row(r) `vec4f row(int r)` Select a row as a vector. .. method:: transpose() `mat4x4 transpose()` Transpose the matrix. .. method:: identity() `mat4x4 identity()` Create an identity matrix. .. method:: rotationX(angle) `mat4x4 rotationX(float angle)` Create a rotation matrix around the X axis. .. method:: rotationY(angle) `mat4x4 rotationY(float angle)` Create a rotation matrix around the Y axis. .. method:: rotationZ(angle) `mat4x4 rotationZ(float angle)` Create a rotation matrix around the Z axis. .. method:: scaling(x, y, z) `mat4x4 scaling(float x, float y, float z)` Create a scaling matrix on three axes. .. method:: translation(x, y, z) `mat4x4 translation(float x, float y, float z)` Create a translation matrix. .. method:: ortho(left, right, bottom_, top, near, far) `mat4x4 ortho(float left, float right, float bottom_, float top, float near, float far)` Create an orthogonal projection matrix. .. method:: perspective(fov, aspect, near, far) `mat4x4 perspective(float fov, float aspect, float near, float far)` Create a perspective matrix.