4 by 4 float matrix template. More...
#include <ArithSqMat4x4Float.h>
Public Types | |
typedef VT | VectorType |
Vector type. | |
typedef VT::ScalarType | ScalarType |
The type of a matrix element. | |
![]() | |
typedef VT | VectorType |
Vector type. | |
typedef VT::ScalarType | ScalarType |
The type of a matrix element. | |
![]() | |
typedef VT | HVectorType |
Horizontal vector type. | |
typedef VT | VVectorType |
Vertical vector type. | |
typedef VT::ScalarType | ScalarType |
The type of a matrix element. | |
Public Member Functions | |
ArithSqMat4x4Float (VT a, VT b, VT c, VT d) noexcept | |
Construct a Mat4x4f from four V vectors. | |
ArithSqMat4x4Float () noexcept | |
Construct the NAN matrix. | |
ArithSqMat4x4Float (ScalarType _a) noexcept | |
Construct matrix where all values are equal to constructor argument. | |
template<class T , class VecT > | |
const VecT | mul_3D_vector (const ArithVec3Float< T, VecT > &v_in) const |
template<class T , class VecT > | |
const VecT | mul_3D_point (const ArithVec3Float< T, VecT > &v_in) const |
template<class T , class VecT > | |
const VecT | project_3D_point (const ArithVec3Float< T, VecT > &v_in) const |
![]() | |
const M & | operator*= (const M &m2) noexcept |
const M & | operator*= (ScalarType k) noexcept |
void | identity () |
![]() | |
const ScalarType * | get () const |
ScalarType * | get () |
const VT & | operator[] (unsigned int i) const |
Const index operator. Returns i'th row of matrix. | |
VT & | operator[] (unsigned int i) |
Non-const index operator. Returns i'th row of matrix. | |
bool | operator== (const M &v) const |
Equality operator. | |
bool | operator!= (const M &v) const |
Inequality operator. | |
const M | operator* (ScalarType k) const |
Multiply scalar onto matrix. All entries are multiplied by scalar. | |
const M | operator/ (ScalarType k) const |
Divide all entries in matrix by scalar. | |
const M & | operator*= (ScalarType k) |
Assignment multiplication of matrix by scalar. | |
const M & | operator/= (ScalarType k) |
Assignment division of matrix by scalar. | |
const M | operator+ (const M &m1) const |
Add two matrices. | |
const M | operator- (const M &m1) const |
Subtract two matrices. | |
const M | operator- () const |
Negate matrix. | |
const M & | operator+= (const M &v) |
Assigment addition of matrices. | |
const M & | operator-= (const M &v) |
Assigment subtraction of matrices. | |
Additional Inherited Members | |
![]() | |
static unsigned int | get_v_dim () |
Get vertical dimension of matrix. | |
static unsigned int | get_h_dim () |
Get horizontal dimension of matrix. | |
![]() | |
ArithSqMatFloat () noexcept | |
Construct 0 matrix. | |
ArithSqMatFloat (ScalarType _a) noexcept | |
Construct matrix where all values are equal to constructor argument. | |
ArithSqMatFloat (VT _a, VT _b) noexcept | |
Construct 2x2 Matrix from two vectors. | |
ArithSqMatFloat (VT _a, VT _b, VT _c) noexcept | |
Construct 3x3 Matrix from three vectors. | |
ArithSqMatFloat (VT _a, VT _b, VT _c, VT _d) noexcept | |
Construct 4x4 Matrix from four vectors. | |
![]() | |
ArithMatFloat () | |
Construct 0 matrix. | |
ArithMatFloat (ScalarType x) | |
Construct a matrix where all entries are the same. | |
ArithMatFloat (VT_a) | |
Construct a matrix where all rows are the same. | |
ArithMatFloat (VT_a, VT_b) | |
Construct a matrix with two rows. | |
ArithMatFloat (VT_a, VT_b, VT_c) | |
Construct a matrix with three rows. | |
ArithMatFloat (VT_a, VT_b, VT_c, VT_d) | |
Construct a matrix with four rows. | |
![]() | |
VT | data [ROWS] |
The actual contents of the matrix. | |
4 by 4 float matrix template.
this class template is useful for transformations such as perspective projections or translation where 3x3 matrices do not suffice.
|
inline |
Multiply 3D point onto matrix. Here the fourth coordinate becomes 1 to ensure that the point is translated. Note that the vector is converted back into a Vec3f without any division by w. This is deliberate: Typically, w=1 except for projections. If we are doing projection, we can use project_3D_point instead
|
inline |
Multiply vector onto matrix. Here the fourth coordinate is se to 0. This removes any translation from the matrix. Useful if one wants to transform a vector which does not represent a point but a direction. Note that this is not correct for transforming normal vectors if the matric contains anisotropic scaling.
|
inline |
Multiply 3D point onto matrix. We set w=1 before multiplication and divide by w after multiplication.