Public Member Functions | Static Public Member Functions | Related Functions | List of all members
Matrix3D Class Referencefinal

Double precision 3x3 matrix class. More...

#include <cvb/matrix_3d.hpp>

Public Member Functions

 Matrix3D () noexcept=default
 Default constructor for empty matrix. More...
 
template<std::size_t N>
 Matrix3D (const double(&list)[N]) noexcept
 Construct a 3x3 matrix with an initializer list. More...
 
 Matrix3D (double roll, double pitch, double yaw)
 Creates a rotation matrix from the given Euler angles. More...
 
void RollPitchYaw (double &roll, double &pitch, double &yaw) const
 Computes the Euler angles Roll, Pitch and Yaw for this matrix. More...
 
const double * operator[] (int row) const noexcept
 Index based element access. More...
 
double * operator[] (int row) noexcept
 Index based element access. More...
 
const double & At (int row, int column) const noexcept
 Index based element access. More...
 
double & At (int row, int column) noexcept
 Index based element access. More...
 
double Det () const
 Matrix determinant. More...
 
void Invert ()
 Inverts this matrix if possible. More...
 
bool operator== (const Matrix3D &matrix) const noexcept
 Compares to an other matrix. More...
 
bool operator!= (const Matrix3D &matrix) const noexcept
 Compares to an other matrix. More...
 
Matrix3Doperator+= (const Matrix3D &matrix) noexcept
 Adds and assigns to this matrix. More...
 
Matrix3Doperator -= (const Matrix3D &matrix) noexcept
 Subtracts and assigns to this matrix. More...
 
Matrix3Doperator *= (const Matrix3D &matrix)
 Multiplies and assigns to this matrix. More...
 
Matrix3Doperator *= (const double &value) noexcept
 Multiplies and assigns to this matrix. More...
 
Matrix3Doperator/= (const double &value) noexcept
 Divides each element of this matrix by the given value. More...
 

Static Public Member Functions

static Matrix3D Identity () noexcept
 The identity element. More...
 

Related Functions

(Note that these are not member functions.)

Matrix3D operator+ (const Matrix3D &lhs, const Matrix3D &rhs)
 Add two matrices. More...
 
Matrix3D operator- (const Matrix3D &lhs, const Matrix3D &rhs)
 Subtract two matrices. More...
 
Matrix3D operator * (const Matrix3D &lhs, const Matrix3D &rhs)
 Multiply two matrices. More...
 
Point3D< double > operator * (const Matrix3D &lhs, const Point3D< double > &rhs)
 Multiply matrix with 3D point. More...
 
Matrix3D operator * (const Matrix3D &lhs, const double &rhs)
 Multiply matrix with scalar. More...
 
Matrix3D operator * (const double &lhs, const Matrix3D &rhs)
 Multiply scalar with matrix . More...
 
Matrix3D operator/ (const Matrix3D &lhs, const double &rhs)
 Divide matrix by scalar. More...
 

Detailed Description

Double precision 3x3 matrix class.

Constructor & Destructor Documentation

◆ Matrix3D() [1/3]

Matrix3D ( )
defaultnoexcept

Default constructor for empty matrix.

Exceptions
Doesnot throw any exception.

◆ Matrix3D() [2/3]

Matrix3D ( const double(&)  list[N])
inlinenoexcept

Construct a 3x3 matrix with an initializer list.

Parameters
[in]listContaining exactly 9 elements.
Exceptions
Doesnot throw any exception.

◆ Matrix3D() [3/3]

Matrix3D ( double  roll,
double  pitch,
double  yaw 
)
inline

Creates a rotation matrix from the given Euler angles.

Parameters
[in]rollAngle around x″ in degrees.
[in]pitchAngle around y′ axis in degrees.
[in]yawAngle around z axis in degrees.
Exceptions
Anyexception derived from std::exception including CvbException.

Member Function Documentation

◆ At() [1/2]

const double& At ( int  row,
int  column 
) const
inlinenoexcept

Index based element access.

Parameters
[in]rowThe row to access.
[in]columnThe column to access.
Returns
The matrix element.
Exceptions
Doesnot throw any exception.

◆ At() [2/2]

double& At ( int  row,
int  column 
)
inlinenoexcept

Index based element access.

Parameters
[in]rowThe row to access.
[in]columnThe column to access.
Returns
The matrix element.
Exceptions
Doesnot throw any exception.

◆ Det()

double Det ( ) const
inline

Matrix determinant.

Returns
The determinant.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ Identity()

static Matrix3D Identity ( )
inlinestaticnoexcept

The identity element.

Returns
An identity matrix.
Exceptions
Doesnot throw any exception.

◆ Invert()

void Invert ( )
inline

Inverts this matrix if possible.

Exceptions
Anyexception derived from std::exception including CvbException.

Might cause division by zero.

◆ operator *=() [1/2]

Matrix3D& operator *= ( const Matrix3D matrix)
inline

Multiplies and assigns to this matrix.

Parameters
[in]matrixOther matrix.
Returns
This matrix.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ operator *=() [2/2]

Matrix3D& operator *= ( const double &  value)
inlinenoexcept

Multiplies and assigns to this matrix.

Parameters
[in]valueFactor.
Returns
This matrix.
Exceptions
Doesnot throw any exception.

◆ operator -=()

Matrix3D& operator -= ( const Matrix3D matrix)
inlinenoexcept

Subtracts and assigns to this matrix.

Parameters
[in]matrixOther matrix.
Returns
This matrix.
Exceptions
Doesnot throw any exception.

◆ operator!=()

bool operator!= ( const Matrix3D matrix) const
inlinenoexcept

Compares to an other matrix.

Parameters
[in]matrixOther matrix.
Returns
True if not equal, otherwise false.
Exceptions
Doesnot throw any exception.

◆ operator+=()

Matrix3D& operator+= ( const Matrix3D matrix)
inlinenoexcept

Adds and assigns to this matrix.

Parameters
[in]matrixOther matrix.
Returns
This matrix.
Exceptions
Doesnot throw any exception.

◆ operator/=()

Matrix3D& operator/= ( const double &  value)
inlinenoexcept

Divides each element of this matrix by the given value.

Parameters
[in]valueDivisor.
Returns
This matrix.
Exceptions
Doesnot throw any exception.

◆ operator==()

bool operator== ( const Matrix3D matrix) const
inlinenoexcept

Compares to an other matrix.

Parameters
[in]matrixOther matrix.
Returns
True if equal, otherwise false.
Exceptions
Doesnot throw any exception.

◆ operator[]() [1/2]

const double* operator[] ( int  row) const
inlinenoexcept

Index based element access.

Parameters
[in]row
Returns
A raw pointer to the row
Exceptions
Doesnot throw any exception.

◆ operator[]() [2/2]

double* operator[] ( int  row)
inlinenoexcept

Index based element access.

Parameters
[in]row
Returns
A raw pointer to the row
Exceptions
Doesnot throw any exception.

◆ RollPitchYaw()

void RollPitchYaw ( double &  roll,
double &  pitch,
double &  yaw 
) const
inline

Computes the Euler angles Roll, Pitch and Yaw for this matrix.

Parameters
[in]rollVariable to receive angle around x″ in degrees.
[in]pitchVariable to receive angle around y′ in degrees.
[in]yawVariable to receive angle around z axis in degrees.
Exceptions
Anyexception derived from std::exception including CvbException.
Note
If the resulting pitch is outside the range ]-90° .. 90°[, the computation of the Euler angles is ambiguous (rotation direction may be inversed).

Friends And Related Function Documentation

◆ operator *() [1/4]

Matrix3D operator * ( const Matrix3D lhs,
const Matrix3D rhs 
)
related

Multiply two matrices.

Parameters
[in]lhsRight hand side matrix.
[in]rhsLeft hand side matrix.
Returns
The computation result.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ operator *() [2/4]

Point3D< double > operator * ( const Matrix3D lhs,
const Point3D< double > &  rhs 
)
related

Multiply matrix with 3D point.

Parameters
[in]lhsRight hand side matrix.
[in]rhsLeft hand side point.
Returns
The computation result.
Exceptions
Doesnot throw any exception.

◆ operator *() [3/4]

Matrix3D operator * ( const Matrix3D lhs,
const double &  rhs 
)
related

Multiply matrix with scalar.

Parameters
[in]lhsRight hand side matrix.
[in]rhsLeft hand side value.
Returns
The computation result.
Exceptions
Doesnot throw any exception.

◆ operator *() [4/4]

Matrix3D operator * ( const double &  lhs,
const Matrix3D rhs 
)
related

Multiply scalar with matrix .

Parameters
[in]lhsRight hand side value.
[in]rhsLeft hand side matrix.
Returns
The computation result.
Exceptions
Doesnot throw any exception.

◆ operator+()

Matrix3D operator+ ( const Matrix3D lhs,
const Matrix3D rhs 
)
related

Add two matrices.

Parameters
[in]lhsRight hand side matrix.
[in]rhsLeft hand side matrix.
Returns
The computation result.
Exceptions
Doesnot throw any exception.

◆ operator-()

Matrix3D operator- ( const Matrix3D lhs,
const Matrix3D rhs 
)
related

Subtract two matrices.

Parameters
[in]lhsRight hand side matrix.
[in]rhsLeft hand side matrix.
Returns
The computation result.
Exceptions
Doesnot throw any exception.

◆ operator/()

Matrix3D operator/ ( const Matrix3D lhs,
const double &  rhs 
)
related

Divide matrix by scalar.

Parameters
[in]lhsRight hand side matrix.
[in]rhsLeft hand side value.
Returns
The computation result.
Exceptions
Doesnot throw any exception.