rtm/matrix3x4d.h¶
#include "rtm/matrix3x4d.h"
matrix_from_rotation¶
matrix3x4d matrix_from_rotation(matrix3x3d rotation)
Converts a rotation 3x3 matrix into a 3x4 affine matrix.
matrix3x4d matrix_from_rotation(quatd quat)
Converts a rotation quaternion into a 3x3 or 3x4 affine matrix.
The return value also converts to matrix3x3d.
matrix_from_translation¶
matrix3x4d matrix_from_translation(vector4d translation)
Converts a translation vector into a 3x4 affine matrix.
matrix_from_vq¶
matrix3x4d matrix_from_vq(quatd quat, vector4d translation)
Sets a 3x4 affine matrix from a rotation quaternion and translation.
matrix3x4d matrix_from_vq(vqd transform)
Converts a VQ transform into a 3x4 affine matrix.
matrix_from_qv¶
matrix3x4d matrix_from_qv(quatd quat, vector4d translation)
Sets a 3x4 affine matrix from a rotation quaternion and translation.
Deprecated
Use 'matrix_from_vq' instead. To be removed in 2.5.
matrix3x4d matrix_from_qv(vqd 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¶
matrix3x4d matrix_from_vqs(quatd quat, vector4d translation, double scale)
Sets a 3x4 affine matrix from a rotation quaternion, translation, and scalar scale.
matrix3x4d matrix_from_vqs(vqsd transform)
Converts a VQS transform into a 3x4 affine matrix.
matrix_from_qvs¶
matrix3x4d matrix_from_qvs(quatd quat, vector4d translation, double 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.
matrix3x4d matrix_from_qvs(vqsd 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¶
matrix3x4d matrix_from_vqv(quatd quat, vector4d translation, vector4d scale)
Sets a 3x4 affine matrix from a rotation quaternion, translation, and 3D scale.
matrix3x4d matrix_from_vqv(vqvd transform)
Converts a VQV transform into a 3x4 affine matrix.
matrix_from_qvv¶
matrix3x4d matrix_from_qvv(quatd quat, vector4d translation, vector4d 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.
matrix3x4d matrix_from_qvv(vqvd 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 vector4d matrix_get_coord_forward(matrix3x4d 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(matrix3x4d 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(matrix3x4d 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(matrix3x4d input)
Returns the axis holding the position of the default coordinate system (W+).
matrix_get_axis¶
constexpr vector4d matrix_get_axis(matrix3x4d input, axis4 axis)
Returns the desired 3x4 affine matrix axis.
matrix_set_axis¶
matrix3x4d matrix_set_axis(matrix3x4d input, vector4d axis_value, axis4 axis)
Returns a new 3x4 matrix where the specified axis has been replaced on the input matrix.
matrix_get_component¶
double matrix_get_component(matrix3x4d input, axis4 axis, component3 component)
Returns the desired 3x4 matrix component from the specified axis.
matrix_get_component_as_scalar¶
scalard matrix_get_component_as_scalar(matrix3x4d input, axis4 axis, component3 component)
Returns the desired 3x4 matrix component from the specified axis.
matrix_set_component¶
matrix3x4d matrix_set_component(matrix3x4d input, double 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¶
quatd quat_from_matrix(matrix3x4d input)
Converts a 3x4 affine matrix into a rotation quaternion.
matrix_mul¶
matrix3x4d matrix_mul(matrix3x4d lhs, matrix3x4d 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¶
vector4d matrix_mul_point3(vector4d point, matrix3x4d_argn 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¶
vector4d matrix_mul_vector3(vector4d vec3, matrix3x4d_argn 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¶
matrix3x3d matrix_transpose(matrix3x4d 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¶
matrix3x4d matrix_inverse(matrix3x4d 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.
matrix3x4d matrix_inverse(matrix3x4d input, matrix3x4d_argn fallback, double threshold=1.0E-8)
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¶
scalard matrix_determinant(matrix3x4d input)
Returns the determinant of the 3x3 rotation/scale part of the input 3x4 matrix.
matrix_minor¶
scalard matrix_minor(matrix3x4d 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¶
matrix3x3d matrix_cofactor(matrix3x4d 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¶
matrix3x3d matrix_adjugate(matrix3x4d input)
Returns the adjugate of the input matrix. See: https://en.wikipedia.org/wiki/Adjugate_matrix
matrix_remove_scale¶
matrix3x4d matrix_remove_scale(matrix3x4d 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¶
matrix3x4d matrix_from_quat(quatd quat)
Converts a rotation quaternion into a 3x3 or 3x4 affine matrix.
The return value also converts to matrix3x3d.
matrix_from_scale¶
matrix3x4d matrix_from_scale(vector4d scale)
Converts a 3D scale vector into a 3x3 or 3x4 affine matrix.
The return value also converts to matrix3x3d.
matrix_cast¶
template<typename matrix_type>
matrix3x4d 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, matrix4x4f and matrix4x4d.
matrix_set¶
matrix3x4d 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 matrix3x4f, matrix4x4d and matrix4x4f.
matrix_identity¶
matrix3x4d matrix_identity()
Returns the identity matrix.
The return value also converts to matrix3x3d, matrix3x3f, matrix3x4f, matrix4x4d and matrix4x4f.