rtm/matrix3x3f.h¶
#include "rtm/matrix3x3f.h"
matrix_get_coord_forward¶
constexpr vector4f matrix_get_coord_forward(matrix3x3f input)
Returns the axis pointing in the forward direction of the default coordinate system (Z+).
matrix_get_coord_up¶
constexpr vector4f matrix_get_coord_up(matrix3x3f input)
Returns the axis pointing in the up direction of the default coordinate system (Y+).
matrix_get_coord_cross¶
constexpr vector4f matrix_get_coord_cross(matrix3x3f input)
Returns the axis pointing in the cross direction of the default coordinate system (X+).
matrix_get_axis¶
constexpr vector4f matrix_get_axis(matrix3x3f input, axis3 axis)
Returns the desired 3x3 matrix axis.
matrix_set_axis¶
matrix3x3f matrix_set_axis(matrix3x3f input, vector4f axis_value, axis3 axis)
Returns a new 3x3 matrix where the specified axis has been replaced on the input matrix.
matrix_get_component¶
float matrix_get_component(matrix3x3f input, axis3 axis, component3 component)
Returns the desired 3x3 matrix component from the specified axis.
matrix_get_component_as_scalar¶
scalarf matrix_get_component_as_scalar(matrix3x3f input, axis3 axis, component3 component)
Returns the desired 3x3 matrix component from the specified axis.
matrix_set_component¶
matrix3x3f matrix_set_component(matrix3x3f input, float component_value, axis3 axis, component3 component)
Returns a new 3x3 matrix where the specified axis/component has been replaced on the input matrix.
quat_from_matrix¶
quatf quat_from_matrix(matrix3x3f input)
Converts a 3x3 matrix into a rotation quaternion.
matrix_mul¶
matrix3x3f matrix_mul(matrix3x3f lhs, matrix3x3f rhs)
Multiplies two 3x3 matrices. Multiplication order is as follow: local_to_world = matrix_mul(local_to_object, object_to_world)
matrix_mul_vector3¶
vector4f matrix_mul_vector3(vector4f vec3, matrix3x3f mtx)
Multiplies a 3x3 matrix and a 3D vector. Multiplication order is as follow: world_position = matrix_mul(local_vector, local_to_world) Note: The proper way to transform a normal by a matrix with non-uniform scale is to multiply the normal with the cofactor matrix. See: https://github.com/graphitemaster/normals_revisited
matrix_transpose¶
matrix3x3f matrix_transpose(matrix3x3f input)
Transposes a 3x3 matrix.
matrix_inverse¶
matrix3x3f matrix_inverse(matrix3x3f input)
Inverses a 3x3 matrix. If the input matrix is not invertible, the result is undefined. For a safe alternative, supply a fallback value and a threshold.
matrix3x3f matrix_inverse(matrix3x3f input, matrix3x3f fallback, float threshold=1.0E-8F)
Inverses a 3x3 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¶
scalarf matrix_determinant(matrix3x3f input)
Returns the determinant of the input 3x3 matrix.
matrix_minor¶
scalarf matrix_minor(matrix3x3f input, axis3 row, axis3 column)
Returns the minor of the input 3x3 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¶
matrix3x3f matrix_cofactor(matrix3x3f input)
Returns the cofactor matrix of the input 3x3 matrix. See: https://en.wikipedia.org/wiki/Minor_(linear_algebra)#Cofactor_expansion_of_the_determinant Note: The proper way to transform a normal by a matrix with non-uniform scale is to multiply the normal with the cofactor matrix. See: https://github.com/graphitemaster/normals_revisited
matrix_adjugate¶
matrix3x3f matrix_adjugate(matrix3x3f input)
Returns the adjugate of the input matrix. See: https://en.wikipedia.org/wiki/Adjugate_matrix
matrix_remove_scale¶
matrix3x3f matrix_remove_scale(matrix3x3f input)
Removes the 3D scale from a 3x3 matrix. Note that if the scaling is 0.0 for a particular axis, the original rotation axis cannot be recovered trivially and no attempt is done to do so. In theory, we could use the other axes to try and recover it.
matrix_from_quat¶
matrix3x3f matrix_from_quat(quatf quat)
Converts a rotation quaternion into a 3x3 or 3x4 affine matrix.
The return value also converts to matrix3x4f.
matrix_from_rotation¶
matrix3x3f matrix_from_rotation(quatf quat)
Converts a rotation quaternion into a 3x3 or 3x4 affine matrix.
The return value also converts to matrix3x4f.
matrix_from_scale¶
matrix3x3f matrix_from_scale(vector4f scale)
Converts a 3D scale vector into a 3x3 or 3x4 affine matrix.
The return value also converts to matrix3x4f.
matrix_cast¶
template<typename matrix_type>
matrix3x3f 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 matrix3x3d, matrix3x4f, matrix3x4d, matrix4x4f and matrix4x4d.
matrix_set¶
constexpr matrix3x3f matrix_set(vector4f x_axis, vector4f y_axis, vector4f z_axis)
Sets all 3 axes and creates a matrix.
matrix_identity¶
matrix3x3f matrix_identity()
Returns the identity matrix.
The return value also converts to matrix3x3d, matrix3x4d, matrix3x4f, matrix4x4d and matrix4x4f.