Skip to content

rtm/matrix4x4d.h

#include "rtm/matrix4x4d.h"

matrix_get_coord_forward

constexpr vector4d matrix_get_coord_forward(matrix4x4d input)

Returns the axis pointing in the forward direction of the default coordinate system (Z+).

matrix_get_coord_up

constexpr vector4d matrix_get_coord_up(matrix4x4d input)

Returns the axis pointing in the up direction of the default coordinate system (Y+).

matrix_get_coord_cross

constexpr vector4d matrix_get_coord_cross(matrix4x4d input)

Returns the axis pointing in the cross direction of the default coordinate system (X+).

matrix_get_coord_position

constexpr vector4d matrix_get_coord_position(matrix4x4d input)

Returns the axis holding the position of the default coordinate system (W+).

matrix_get_axis

constexpr vector4d matrix_get_axis(matrix4x4d input, axis4 axis)

Returns the desired 4x4 matrix axis.

matrix_set_axis

matrix4x4d matrix_set_axis(matrix4x4d input, vector4d axis_value, axis4 axis)

Returns a new 4x4 matrix where the specified axis has been replaced on the input matrix.

matrix_get_component

double matrix_get_component(matrix4x4d input, axis4 axis, component4 component)

Returns the desired 4x4 matrix component from the specified axis.

matrix_get_component_as_scalar

scalard matrix_get_component_as_scalar(matrix4x4d input, axis4 axis, component4 component)

Returns the desired 4x4 matrix component from the specified axis.

matrix_set_component

matrix4x4d matrix_set_component(matrix4x4d input, double component_value, axis4 axis, component4 component)

Returns a new 4x4 matrix where the specified axis/component has been replaced on the input matrix.

matrix_mul

matrix4x4d matrix_mul(matrix4x4d lhs, matrix4x4d rhs)

Multiplies two 4x4 matrices. Multiplication order is as follow: local_to_world = matrix_mul(local_to_object, object_to_world)

matrix_mul_vector

vector4d matrix_mul_vector(vector4d vec4, matrix4x4d_argn mtx)

Multiplies a 4x4 matrix and a 4D vector. Multiplication order is as follow: world_position = matrix_mul(local_position, local_to_world)

matrix_transpose

matrix4x4d matrix_transpose(matrix4x4d input)

Transposes a 4x4 matrix.

matrix_inverse

matrix4x4d matrix_inverse(matrix4x4d input)

Inverses a 4x4 matrix. If the input matrix is not invertible, the result is undefined. For a safe alternative, supply a fallback value and a threshold.

matrix4x4d matrix_inverse(matrix4x4d input, matrix4x4d_argn fallback, double threshold=1.0E-8)

Inverses a 4x4 matrix. If the input matrix has a determinant whose absolute value is below the supplied threshold, the fall back value is returned instead.

matrix_determinant

scalard matrix_determinant(matrix4x4d input)

Returns the determinant of the input 4x4 matrix.

matrix_minor

scalard matrix_minor(matrix4x4d input, axis4 row, axis4 column)

Returns the minor of the input 4x4 matrix. See: https://en.wikipedia.org/wiki/Minor_(linear_algebra) The minor is the determinant of the sub-matrix input when the specified row and column are removed.

matrix_cofactor

matrix4x4d matrix_cofactor(matrix4x4d input)

Returns the cofactor matrix of the input 4x4 matrix. See: https://en.wikipedia.org/wiki/Minor_(linear_algebra)#Cofactor_expansion_of_the_determinant

matrix_adjugate

matrix4x4d matrix_adjugate(matrix4x4d input)

Returns the adjugate of the input matrix. See: https://en.wikipedia.org/wiki/Adjugate_matrix

matrix_cast

template<typename matrix_type>
matrix4x4d matrix_cast(const matrix_type& input)

Casts a matrix from one variant to another. Note: When casting a smaller matrix into a larger one, new elements are undefined.

The return value also converts to matrix3x3f, matrix3x3d, matrix3x4f, matrix3x4d and matrix4x4f.

matrix_set

matrix4x4d matrix_set(vector4d x_axis, vector4d y_axis, vector4d z_axis, vector4d w_axis)

Sets all 4 axes and creates a matrix.

The return value also converts to matrix3x4d, matrix3x4f and matrix4x4f.

matrix_identity

matrix4x4d matrix_identity()

Returns the identity matrix.

The return value also converts to matrix3x3d, matrix3x3f, matrix3x4d, matrix3x4f and matrix4x4f.