Skip to content

Matrix4

A 4x4 matrix class for mathematical operations.

Stores the matrix in column-major order using four Vector4 columns. Commonly used for 3D transformations including translation, rotation, scaling, and projection.

Functions

Matrix4() constexpr

cpp
vglx::Matrix4::Matrix4(const Vector4 &a, const Vector4 &b, const Vector4 &c, const Vector4 &d)
ParameterDescription
aFirst column vector.
bSecond column vector.
cThird column vector.
dFourth column vector.

Constructs a Matrix4 object from four column vectors.

Matrix4() constexpr

cpp
vglx::Matrix4::Matrix4(float n00, float n01, float n02, float n03, float n10, float n11, float n12, float n13, float n20, float n21, float n22, float n23, float n30, float n31, float n32, float n33)
ParameterDescription
n00First row, first element.
n01First row, second element.
n02First row, third element.
n03First row, fourth element.
n10Second row, first element.
n11Second row, second element.
n12Second row, third element.
n13Second row, fourth element.
n20Third row, first element.
n21Third row, second element.
n22Third row, third element.
n23Third row, fourth element.
n30Fourth row, first element.
n31Fourth row, second element.
n32Fourth row, third element.
n33Fourth row, fourth element.

Constructs a Matrix4 object from individual components (row-major).

Matrix4() constexpr

cpp
vglx::Matrix4::Matrix4(float value)
ParameterDescription
valueValue to place on the diagonal.

Constructs a diagonal Matrix4 with the given scalar value.

operator()() auto &

cpp
auto & vglx::Matrix4::operator()(int i, int j)
ParameterDescription
iRow index (0 to 3).
jColumn index (0 to 3).

Access matrix element by (row, column).

operator()() const auto &

cpp
const auto & vglx::Matrix4::operator()(int i, int j) const
ParameterDescription
iRow index (0 to 3).
jColumn index (0 to 3).

Access matrix element by (row, column) (const).

operator[]() auto &

cpp
auto & vglx::Matrix4::operator[](int j)
ParameterDescription
jColumn index (0 to 3).

Access matrix column vector by index.

operator[]() const auto &

cpp
const auto & vglx::Matrix4::operator[](int j) const
ParameterDescription
jColumn index (0 to 3).

Access matrix column vector by index (const).

Matrix4::Identity() auto

cpp
static constexpr auto vglx::Matrix4::Identity()

Returns the identity matrix.

Determinant() VGLX_EXPORT constexpr auto

cpp
VGLX_EXPORT constexpr auto Determinant(const Matrix4 &m)
ParameterDescription
mInput matrix.

Computes the determinant of a Matrix4 object.

Inverse() VGLX_EXPORT constexpr auto

cpp
VGLX_EXPORT constexpr auto Inverse(const Matrix4 &m)
ParameterDescription
mInput matrix.

Computes the inverse of a Matrix4 object.

Transpose() VGLX_EXPORT constexpr auto

cpp
VGLX_EXPORT constexpr auto Transpose(const Matrix4 &m)
ParameterDescription
mInput matrix.

Computes the transpose of a Matrix4 object.

Released under the MIT License.