SpatiumLib
|
4-by-4 matrix to represent and manipulate 3D transformations. More...
#include <Matrix4x4.h>
Public Member Functions | |
Matrix4x4 () | |
Constructor. More... | |
Matrix4x4 (const Matrix4x4 &other) | |
Copy constructor. More... | |
Matrix4x4 (const Matrix &other) | |
Copy constructor. More... | |
Matrix4x4 & | operator= (const Matrix4x4 &other)=default |
Assignment operator. More... | |
~Matrix4x4 ()=default | |
Destructor. More... | |
![]() | |
Matrix (size_t rows, size_t cols) | |
Constructor. More... | |
Matrix (std::initializer_list< std::initializer_list< double >> array) | |
Constructor. More... | |
bool | operator== (const Matrix &other) const |
Compare operator. Is equal. More... | |
bool | operator!= (const Matrix &other) const |
Compare operator. Is unequal. More... | |
size_t | rows () const |
Get the number of rows. More... | |
size_t | cols () const |
Get the number of columns. More... | |
std::vector< double > | data () const |
Get all matrix elements. More... | |
void | clear () |
Clear all matrix elements. More... | |
Matrix | transposed () const |
Get transposed matrix. More... | |
double | determinant () const |
Calculate determinant. More... | |
double | minor (size_t row, size_t col) const |
Calulcate minor. More... | |
Matrix | omit (size_t row, size_t col) const |
Omit a given row and column. More... | |
Matrix | inverse () const |
Calculate inverse of matrix. More... | |
double | operator() (size_t row, size_t col) const |
Access element by value. More... | |
double & | operator() (size_t row, size_t col) |
Access element by reference. More... | |
Matrix | operator+ (const Matrix &other) const |
Add by matrix. More... | |
Matrix | operator- (const Matrix &other) const |
Subtract by matrix. More... | |
Matrix | operator * (const Matrix &other) const |
Multiply by matrix. More... | |
Matrix | operator * (double scalar) const |
Multiply by scalar. More... | |
Matrix | operator/ (double scalar) const |
Divide by scalar. More... | |
void | resize (size_t rows, size_t cols) |
Resize. More... | |
Static Public Member Functions | |
static Matrix4x4 | translation (double x, double y, double z) |
Construct translation matrix. More... | |
static Matrix4x4 | scaling (double x, double y, double z) |
Construct scaling matrix. More... | |
static Matrix4x4 | rotation (double x, double y, double z) |
Construct rotation matrix (counterclockwise). More... | |
static Matrix4x4 | rotationX (double angle) |
Construct matrix for rotation around X axis (counterclockwise). More... | |
static Matrix4x4 | rotationY (double angle) |
Construct matrix for rotation around Y axis (counterclockwise). More... | |
static Matrix4x4 | rotationZ (double angle) |
Construct matrix for rotation around Z axis (counterclockwise). More... | |
static Matrix4x4 | rotationAround (const Vector3 &axis, double angle) |
Construct matrix for rotation around axis (counterclockwise). More... | |
![]() | |
static Matrix | identity (size_t order) |
Construct identity matrix. More... | |
Additional Inherited Members | |
![]() | |
double | determinant (const Matrix &matrix) const |
Calculate determinant. More... | |
![]() | |
size_t | m_rows |
size_t | m_cols |
std::vector< double > | m_data |
4-by-4 matrix to represent and manipulate 3D transformations.
Matrix4x4 is a class to represent and manipulate 4x4 matrices. Specifically, it is designed to work on 4x4 transformation matrices found in 3D rendering using homogeneous coordinates [x y z w].
|
inline |
Constructor.
|
inline |
Copy constructor.
|
inline |
Copy constructor.
[in] | other | Other matrix |
std::out_of_range | Matrix dimenions != 4 |
|
default |
Destructor.
Assignment operator.
|
inlinestatic |
Construct rotation matrix (counterclockwise).
[in] | x | Rotation on X axis |
[in] | y | Rotation on Y axis |
[in] | z | Rotation on Z axis |
|
inlinestatic |
Construct matrix for rotation around axis (counterclockwise).
[in] | axis | Axis vector |
[in] | angle | Angle in radians |
|
inlinestatic |
Construct matrix for rotation around X axis (counterclockwise).
[in] | angle | Angle in radians |
|
inlinestatic |
Construct matrix for rotation around Y axis (counterclockwise).
[in] | angle | Angle in radians |
|
inlinestatic |
Construct matrix for rotation around Z axis (counterclockwise).
[in] | angle | Angle in radians |
|
inlinestatic |
Construct scaling matrix.
[in] | x | Scaling on X axis |
[in] | y | Scaling on Y axis |
[in] | z | Scaling on Z axis |
|
inlinestatic |
Construct translation matrix.
[in] | x | Translation on X axis |
[in] | y | Translation on Y axis |
[in] | z | Translation on Z axis |