SpatiumLib
Public Member Functions | Static Public Member Functions | List of all members
spatium::geom3d::Matrix4x4 Class Reference

4-by-4 matrix to represent and manipulate 3D transformations. More...

#include <Matrix4x4.h>

Inheritance diagram for spatium::geom3d::Matrix4x4:
Inheritance graph
[legend]
Collaboration diagram for spatium::geom3d::Matrix4x4:
Collaboration graph
[legend]

Public Member Functions

 Matrix4x4 ()
 Constructor. More...
 
 Matrix4x4 (const Matrix4x4 &other)
 Copy constructor. More...
 
 Matrix4x4 (const Matrix &other)
 Copy constructor. More...
 
Matrix4x4operator= (const Matrix4x4 &other)=default
 Assignment operator. More...
 
 ~Matrix4x4 ()=default
 Destructor. More...
 
- Public Member Functions inherited from spatium::Matrix
 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 Public Member Functions inherited from spatium::Matrix
static Matrix identity (size_t order)
 Construct identity matrix. More...
 

Additional Inherited Members

- Protected Member Functions inherited from spatium::Matrix
double determinant (const Matrix &matrix) const
 Calculate determinant. More...
 
- Protected Attributes inherited from spatium::Matrix
size_t m_rows
 
size_t m_cols
 
std::vector< double > m_data
 

Detailed Description

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].

Constructor & Destructor Documentation

◆ Matrix4x4() [1/3]

spatium::geom3d::Matrix4x4::Matrix4x4 ( )
inline

Constructor.

◆ Matrix4x4() [2/3]

spatium::geom3d::Matrix4x4::Matrix4x4 ( const Matrix4x4 other)
inline

Copy constructor.

◆ Matrix4x4() [3/3]

spatium::geom3d::Matrix4x4::Matrix4x4 ( const Matrix other)
inline

Copy constructor.

Parameters
[in]otherOther matrix
Exceptions
std::out_of_rangeMatrix dimenions != 4

◆ ~Matrix4x4()

spatium::geom3d::Matrix4x4::~Matrix4x4 ( )
default

Destructor.

Member Function Documentation

◆ operator=()

Matrix4x4& spatium::geom3d::Matrix4x4::operator= ( const Matrix4x4 other)
default

Assignment operator.

◆ rotation()

static Matrix4x4 spatium::geom3d::Matrix4x4::rotation ( double  x,
double  y,
double  z 
)
inlinestatic

Construct rotation matrix (counterclockwise).

Parameters
[in]xRotation on X axis
[in]yRotation on Y axis
[in]zRotation on Z axis
Returns
Rotation matrix

◆ rotationAround()

static Matrix4x4 spatium::geom3d::Matrix4x4::rotationAround ( const Vector3 axis,
double  angle 
)
inlinestatic

Construct matrix for rotation around axis (counterclockwise).

Parameters
[in]axisAxis vector
[in]angleAngle in radians
Returns
Rotation matrix

◆ rotationX()

static Matrix4x4 spatium::geom3d::Matrix4x4::rotationX ( double  angle)
inlinestatic

Construct matrix for rotation around X axis (counterclockwise).

Parameters
[in]angleAngle in radians
Returns
Rotation matrix

◆ rotationY()

static Matrix4x4 spatium::geom3d::Matrix4x4::rotationY ( double  angle)
inlinestatic

Construct matrix for rotation around Y axis (counterclockwise).

Parameters
[in]angleAngle in radians
Returns
Rotation matrix

◆ rotationZ()

static Matrix4x4 spatium::geom3d::Matrix4x4::rotationZ ( double  angle)
inlinestatic

Construct matrix for rotation around Z axis (counterclockwise).

Parameters
[in]angleAngle in radians
Returns
Rotation matrix

◆ scaling()

static Matrix4x4 spatium::geom3d::Matrix4x4::scaling ( double  x,
double  y,
double  z 
)
inlinestatic

Construct scaling matrix.

Parameters
[in]xScaling on X axis
[in]yScaling on Y axis
[in]zScaling on Z axis
Returns
Scaling matrix

◆ translation()

static Matrix4x4 spatium::geom3d::Matrix4x4::translation ( double  x,
double  y,
double  z 
)
inlinestatic

Construct translation matrix.

Parameters
[in]xTranslation on X axis
[in]yTranslation on Y axis
[in]zTranslation on Z axis
Returns
Translation matrix

The documentation for this class was generated from the following file: