std.math.matrix

Module entries: 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.

rotateX(by)

mat4x4 rotateX(float by)

Add a rotation around X by by in radians.

rotateY(by)

mat4x4 rotateY(float by)

Add a rotation around Y by by in radians.

rotateZ(by)

mat4x4 rotateZ(float by)

Add a rotation around Z by by in radians.

scale(x, y, z)

mat4x4 scale(float x, float y, float z)

Scale the matrix in three dimensions.

translate(x, y, z)

mat4x4 translate(float x, float y, float z)

Translate the matrix.

mul(other)

mat4x4 mul(mat4x4 other)

Multiply with another matrix.

transform(vec)

vec4f transform(vec4f vec)

row(r)

vec4f row(int r)

Select a row as a vector.

transpose()

mat4x4 transpose()

Transpose the matrix.

identity()

mat4x4 identity()

Create an identity matrix.

rotationX(angle)

mat4x4 rotationX(float angle)

Create a rotation matrix around the X axis.

rotationY(angle)

mat4x4 rotationY(float angle)

Create a rotation matrix around the Y axis.

rotationZ(angle)

mat4x4 rotationZ(float angle)

Create a rotation matrix around the Z axis.

scaling(x, y, z)

mat4x4 scaling(float x, float y, float z)

Create a scaling matrix on three axes.

translation(x, y, z)

mat4x4 translation(float x, float y, float z)

Create a translation matrix.

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.

perspective(fov, aspect, near, far)

mat4x4 perspective(float fov, float aspect, float near, float far)

Create a perspective matrix.