Go to the documentation of this file.
7 #ifndef INCLUDE_JET_MATRIX4X4_H_
8 #define INCLUDE_JET_MATRIX4X4_H_
29 static_assert(std::is_floating_point<T>::value,
30 "Matrix only can be instantiated with floating point types");
44 Matrix(T m00, T m01, T m02, T m10, T m11, T m12, T m20, T m21, T m22);
48 Matrix(T m00, T m01, T m02, T m03, T m10, T m11, T m12, T m13, T m20, T m21,
49 T m22, T m23, T m30, T m31, T m32, T m33);
71 Matrix(
const std::initializer_list<std::initializer_list<U>>& lst);
94 void set(T m00, T m01, T m02, T m10, T m11, T m12, T m20, T m21, T m22);
98 void set(T m00, T m01, T m02, T m03, T m10, T m11, T m12, T m13, T m20,
99 T m21, T m22, T m23, T m30, T m31, T m32, T m33);
121 template <
typename U>
122 void set(
const std::initializer_list<std::initializer_list<U>>& lst);
153 double tol = std::numeric_limits<double>::epsilon())
const;
303 template <
typename U>
376 std::array<T, 16> _elements;
380 template <
typename T>
385 template <
typename T>
389 template <
typename T>
393 template <
typename T>
397 template <
typename T>
401 template <
typename T>
405 template <
typename T>
409 template <
typename T>
413 template <
typename T>
417 template <
typename T>
421 template <
typename T>
425 template <
typename T>
429 template <
typename T>
433 template <
typename T>
437 template <
typename T>
441 template <
typename T>
445 template <
typename T>
456 #include "detail/matrix4x4-inl.h"
458 #endif // INCLUDE_JET_MATRIX4X4_H_
T trace() const
Returns sum of all diagonal elements.
Matrix mul(T s) const
Returns this matrix * input scalar.
Matrix mul(const Matrix &m) const
Returns this matrix * input matrix.
size_t rows() const
Returns number of rows of this matrix.
T * data()
Returns data pointer of this matrix.
Matrix & operator*=(const Matrix &m)
Multiplication assignment with input matrix.
Matrix strictUpperTri() const
Returns strictly upper triangle part of this matrix.
Matrix rdiv(T s) const
Returns input matrix / this scalar.
T min() const
Returns minimum among all elements.
Matrix lowerTri() const
Returns lower triangle part of this matrix (including the diagonal).
static Matrix makeTranslationMatrix(const Vector3< T > &t)
Makes translation matrix.
Matrix< U, 4, 4 > castTo() const
Matrix & operator+=(const Matrix &m)
Addition assignment with input matrix (element-wise).
void imul(const Matrix3x3< T > &m33)
void transpose()
Transposes this matrix.
bool operator==(const Matrix &m) const
Returns true if is equal to m.
Static-sized M x N matrix class.
Definition: matrix.h:29
T absmax() const
Returns absolute maximum among all elements.
bool isSimilar(const Matrix &m, double tol=std::numeric_limits< double >::epsilon()) const
void idiv(T s)
Divides this matrix with input scalar.
Matrix4x4< float > Matrix4x4F
Float-type 4x4 matrix.
Definition: matrix4x4.h:449
Matrix()
Constructs identity matrix.
void imul(T s)
Multiplies input scalar to this matrix.
Matrix div(T s) const
Returns this matrix / input scalar.
Matrix & operator*=(T s)
Multiplication assignment with input scalar.
Matrix & operator-=(const Matrix &m)
Subtraction assignment with input matrix (element-wise).
T max() const
Returns maximum among all elements.
const T * data() const
Returns constant pointer of this matrix.
Matrix(T m00, T m01, T m02, T m10, T m11, T m12, T m20, T m21, T m22)
static Matrix makeIdentity()
Makes all diagonal elements to 1, and other elements to 0.
const T & operator[](size_t i) const
Returns constant reference of i-th element.
const T & operator()(size_t i, size_t j) const
Returns constant reference of (i,j) element.
3-D matrix class.
Definition: matrix3x3.h:28
Matrix(T m00, T m01, T m02, T m03, T m10, T m11, T m12, T m13, T m20, T m21, T m22, T m23, T m30, T m31, T m32, T m33)
void setColumn(size_t i, const Vector4< T > &col)
Sets i-th column with input vector.
void set(T s)
Sets whole matrix with input scalar.
void setRow(size_t i, const Vector4< T > &row)
Sets i-th row with input vector.
4-D vector class.
Definition: vector4.h:25
Matrix & operator-=(T s)
Subtraction assignment with input scalar.
Definition: advection_solver2.h:18
Matrix radd(const Matrix &m) const
Returns input matrix + this matrix (element-wise).
void set(T m00, T m01, T m02, T m03, T m10, T m11, T m12, T m13, T m20, T m21, T m22, T m23, T m30, T m31, T m32, T m33)
Matrix(const std::initializer_list< std::initializer_list< U >> &lst)
Constructs a matrix with given initializer list lst.
void set(const Matrix3x3< T > &m33)
void iadd(const Matrix &m)
Adds input matrix to this matrix (element-wise).
Matrix sub(const Matrix &m) const
Returns this matrix - input matrix (element-wise).
Matrix(const Matrix3x3< T > &m33)
bool isSquare() const
Returns true if this matrix is a square matrix.
void isub(const Matrix &m)
Subtracts input matrix from this matrix (element-wise).
void set(T m00, T m01, T m02, T m10, T m11, T m12, T m20, T m21, T m22)
void set(const std::initializer_list< std::initializer_list< U >> &lst)
Sets a matrix with given initializer list lst.
Matrix offDiagonal() const
Returns off-diagonal part of this matrix.
static Matrix makeScaleMatrix(const Vector3< T > &s)
Makes scale matrix.
Matrix & operator/=(T s)
Division assignment with input scalar.
Matrix2x2< T > operator+(const Matrix2x2< T > &a, const Matrix2x2< T > &b)
Returns a + b (element-size).
void invert()
Inverts this matrix.
Matrix radd(T s) const
Returns input scalar + this matrix.
4-D matrix class.
Definition: matrix4x4.h:27
Matrix sub(T s) const
Returns this matrix - input scalar.
Matrix upperTri() const
Returns upper triangle part of this matrix (including the diagonal).
Matrix rmul(T s) const
Returns input scalar * this matrix.
Matrix transposed() const
Returns transposed matrix.
static Matrix makeZero()
Sets all matrix entries to zero.
Matrix4x4< double > Matrix4x4D
Double-type 4x4 matrix.
Definition: matrix4x4.h:452
Matrix(const Matrix &m)
Constructs a matrix with input matrix.
Matrix strictLowerTri() const
Returns strictly lower triangle part of this matrix.
Matrix & operator*=(const Matrix3x3< T > &m)
static Matrix makeScaleMatrix(T sx, T sy, T sz)
Makes scale matrix.
T absmin() const
Returns absolute minimum among all elements.
T determinant() const
Returns determinant of this matrix.
Matrix & operator=(const Matrix &m)
Assigns input matrix.
3-D vector class.
Definition: vector3.h:25
static Matrix makeRotationMatrix(const Vector3< T > &axis, T rad)
Matrix inverse() const
Returns inverse matrix.
Matrix rmul(const Matrix &m) const
Returns input matrix * this matrix.
Matrix rsub(T s) const
Returns input scalar - this matrix.
void imul(const Matrix &m)
Multiplies input matrix to this matrix.
T & operator()(size_t i, size_t j)
Returns reference of (i,j) element.
Matrix2x2< T > operator/(const Matrix2x2< T > &a, T b)
Returns a' / b, where every element of matrix a' is a.
void setDiagonal(T s)
Sets diagonal elements with input scalar.
T sum() const
Returns sum of all elements.
Matrix< T, 3, 3 > matrix3() const
Returns 3x3 part of this matrix.
T avg() const
Returns average of all elements.
Matrix & operator+=(T s)
Addition assignment with input scalar.
Matrix2x2< T > operator-(const Matrix2x2< T > &a)
Returns a matrix with opposite sign.
size_t cols() const
Returns number of columns of this matrix.
void iadd(T s)
Adds input scalar to this matrix.
bool operator!=(const Matrix &m) const
Returns true if is not equal to m.
void setOffDiagonal(T s)
Sets off-diagonal elements with input scalar.
Matrix rsub(const Matrix &m) const
Returns input matrix - this matrix (element-wise).
Matrix diagonal() const
Returns diagonal part of this matrix.
Matrix2x2< T > operator*(const Matrix2x2< T > &a, T b)
Returns a * b', where every element of matrix b' is b.
void isub(T s)
Subtracts input scalar from this matrix.
void set(const Matrix &m)
Copies from input matrix.
Matrix add(const Matrix &m) const
Returns this matrix + input matrix (element-wise).
Matrix add(T s) const
Returns this matrix + input scalar.
Matrix(T s)
Constructs constant value matrix.
T & operator[](size_t i)
Returns reference of i-th element.
Vector4< T > mul(const Vector4< T > &v) const
Returns this matrix * input vector.