rtm/matrix3x4f.h¶
#include "rtm/matrix3x4f.h"
matrix_from_rotation¶
matrix3x4f matrix_from_rotation(matrix3x3f rotation)
Converts a rotation 3x3 matrix into a 3x4 affine matrix.
matrix3x4f matrix_from_rotation(quatf quat)
Converts a rotation quaternion into a 3x3 or 3x4 affine matrix.
The return value also converts to matrix3x3f.
matrix_from_translation¶
matrix3x4f matrix_from_translation(vector4f translation)
Converts a translation vector into a 3x4 affine matrix.
matrix_from_vq¶
matrix3x4f matrix_from_vq(quatf quat, vector4f translation)
Sets a 3x4 affine matrix from a rotation quaternion and translation.
matrix3x4f matrix_from_vq(vqf transform)
Converts a VQ transform into a 3x4 affine matrix.
matrix_from_qv¶
matrix3x4f matrix_from_qv(quatf quat, vector4f translation)
Sets a 3x4 affine matrix from a rotation quaternion and translation.
Deprecated
Use 'matrix_from_vq' instead. To be removed in 2.5.
matrix3x4f matrix_from_qv(vqf transform)
Converts a VQ transform into a 3x4 affine matrix.
Deprecated
Use 'matrix_from_vq' instead. To be removed in 2.5.
matrix_from_vqs¶
matrix3x4f matrix_from_vqs(quatf quat, vector4f translation, float scale)
Sets a 3x4 affine matrix from a rotation quaternion, translation, and scalar scale.
matrix3x4f matrix_from_vqs(vqsf transform)
Converts a VQS transform into a 3x4 affine matrix.
matrix_from_qvs¶
matrix3x4f matrix_from_qvs(quatf quat, vector4f translation, float scale)
Sets a 3x4 affine matrix from a rotation quaternion, translation, and scalar scale.
Deprecated
Use 'matrix_from_vqs' instead. To be removed in 2.5.
matrix3x4f matrix_from_qvs(vqsf transform)
Converts a VQS transform into a 3x4 affine matrix.
Deprecated
Use 'matrix_from_vqs' instead. To be removed in 2.5.
matrix_from_vqv¶
matrix3x4f matrix_from_vqv(quatf quat, vector4f translation, vector4f scale)
Sets a 3x4 affine matrix from a rotation quaternion, translation, and 3D scale.
matrix3x4f matrix_from_vqv(vqvf transform)
Converts a VQV transform into a 3x4 affine matrix.
matrix_from_qvv¶
matrix3x4f matrix_from_qvv(quatf quat, vector4f translation, vector4f scale)
Sets a 3x4 affine matrix from a rotation quaternion, translation, and 3D scale.
Deprecated
Use 'matrix_from_vqv' instead. To be removed in 2.5.
matrix3x4f matrix_from_qvv(vqvf transform)
Converts a VQV transform into a 3x4 affine matrix.
Deprecated
Use 'matrix_from_vqv' instead. To be removed in 2.5.
matrix_get_coord_forward¶
constexpr vector4f matrix_get_coord_forward(matrix3x4f 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(matrix3x4f 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(matrix3x4f input)
Returns the axis pointing in the cross direction of the default coordinate system (X+).
matrix_get_coord_position¶
constexpr vector4f matrix_get_coord_position(matrix3x4f input)
Returns the axis holding the position of the default coordinate system (W+).
matrix_get_axis¶
constexpr const vector4f & matrix_get_axis(const matrix3x4f& input, axis4 axis)
Returns the desired 3x4 affine matrix axis.
matrix_set_axis¶
matrix3x4f matrix_set_axis(matrix3x4f input, vector4f axis_value, axis4 axis)
Returns a new 3x4 matrix where the specified axis has been replaced on the input matrix.
matrix_get_component¶
float matrix_get_component(matrix3x4f input, axis4 axis, component3 component)
Returns the desired 3x4 matrix component from the specified axis.
matrix_get_component_as_scalar¶
scalarf matrix_get_component_as_scalar(matrix3x4f input, axis4 axis, component3 component)
Returns the desired 3x4 matrix component from the specified axis.
matrix_set_component¶
matrix3x4f matrix_set_component(matrix3x4f input, float component_value, axis4 axis, component3 component)
Returns a new 3x4 matrix where the specified axis/component has been replaced on the input matrix.
quat_from_matrix¶
quatf quat_from_matrix(matrix3x4f input)
Converts a 3x4 affine matrix into a rotation quaternion.
matrix_mul¶
matrix3x4f matrix_mul(matrix3x4f lhs, matrix3x4f rhs)
Multiplies two 3x4 affine matrices. Multiplication order is as follow: local_to_world = matrix_mul(local_to_object, object_to_world)
matrix_mul_point3¶
vector4f matrix_mul_point3(vector4f point, matrix3x4f mtx)
Multiplies a 3x4 affine matrix and a 3D point. Multiplication order is as follow: world_position = matrix_mul(local_position, local_to_world)
matrix_mul_vector3¶
vector4f matrix_mul_vector3(vector4f vec3, matrix3x4f mtx)
Multiplies a 3x4 affine 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 an affine matrix with non-uniform scale is to multiply the normal with the cofactor matrix of the 3x3 rotation/scale part. See: https://github.com/graphitemaster/normals_revisited
matrix_transpose¶
matrix3x3f matrix_transpose(matrix3x4f input)
Transposes a 3x4 affine matrix. Note: This transposes the upper 3x3 rotation/scale part of the matrix and it discards the translation. This is because a transposed 4x4 affine matrix is no longer affine due to its last row no longer being [0, 0, 0, 1]. The most common usage of an affine transpose operation is to construct the inverse transpose used to transform normal bi-vectors.
matrix_inverse¶
matrix3x4f matrix_inverse(matrix3x4f input)
Inverses a 3x4 affine matrix. If the input matrix is not invertible, the result is undefined. For a safe alternative, supply a fallback value and a threshold.
matrix3x4f matrix_inverse(matrix3x4f input, matrix3x4f fallback, float threshold=1.0E-8F)
Inverses a 3x4 affine 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(matrix3x4f input)
Returns the determinant of the 3x3 rotation/scale part of the input 3x4 matrix.
matrix_minor¶
scalarf matrix_minor(matrix3x4f input, axis3 row, axis3 column)
Returns the minor of the 3x3 rotation/scale part of the input 3x4 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(matrix3x4f input)
Returns the cofactor matrix of the 3x3 rotation/scale part of the input 3x4 matrix. See: https://en.wikipedia.org/wiki/Minor_(linear_algebra)#Cofactor_expansion_of_the_determinant Note: The proper way to transform a normal by an affine matrix with non-uniform scale is to multiply the normal with the cofactor matrix of the 3x3 rotation/scale part. See: https://github.com/graphitemaster/normals_revisited
matrix_adjugate¶
matrix3x3f matrix_adjugate(matrix3x4f input)
Returns the adjugate of the input matrix. See: https://en.wikipedia.org/wiki/Adjugate_matrix
matrix_remove_scale¶
matrix3x4f matrix_remove_scale(matrix3x4f input)
Removes the 3D scale from a 3x4 affine 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¶
matrix3x4f matrix_from_quat(quatf quat)
Converts a rotation quaternion into a 3x3 or 3x4 affine matrix.
The return value also converts to matrix3x3f.
matrix_from_scale¶
matrix3x4f matrix_from_scale(vector4f scale)
Converts a 3D scale vector into a 3x3 or 3x4 affine matrix.
The return value also converts to matrix3x3f.
matrix_cast¶
template<typename matrix_type>
matrix3x4f 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, matrix3x4d, matrix4x4f and matrix4x4d.
matrix_set¶
matrix3x4f matrix_set(vector4f x_axis, vector4f y_axis, vector4f z_axis, vector4f w_axis)
Sets all 4 axes and creates a matrix.
The return value also converts to matrix3x4d, matrix4x4d and matrix4x4f.
matrix_identity¶
matrix3x4f matrix_identity()
Returns the identity matrix.
The return value also converts to matrix3x3d, matrix3x3f, matrix3x4d, matrix4x4d and matrix4x4f.