Gazebo Math

API Reference

7.4.0

A 6x6 matrix class. More...

#include <gz/math/Matrix6.hh>

Public Types

enum  Matrix6Corner { TOP_LEFT = 0, TOP_RIGHT = 1, BOTTOM_LEFT = 2, BOTTOM_RIGHT = 3 }
 Identifiers for each of the 4 3x3 corners of the matrix. More...
 

Public Member Functions

 Matrix6 ()
 Constructor. More...
 
 Matrix6 (const Matrix6< T > &_m)=default
 Copy constructor. More...
 
constexpr Matrix6 (T _v00, T _v01, T _v02, T _v03, T _v04, T _v05, T _v10, T _v11, T _v12, T _v13, T _v14, T _v15, T _v20, T _v21, T _v22, T _v23, T _v24, T _v25, T _v30, T _v31, T _v32, T _v33, T _v34, T _v35, T _v40, T _v41, T _v42, T _v43, T _v44, T _v45, T _v50, T _v51, T _v52, T _v53, T _v54, T _v55)
 Constructor. More...
 
bool Equal (const Matrix6 &_m, const T &_tol) const
 Equality test with tolerance. More...
 
bool operator!= (const Matrix6< T > &_m) const
 Inequality test operator. More...
 
T & operator() (const size_t _row, const size_t _col)
 Get a mutable version of the value at the specified row, column index. More...
 
const T & operator() (const size_t _row, const size_t _col) const
 Get the value at the specified row, column index. More...
 
Matrix6< T > operator* (const Matrix6< T > &_m2) const
 Multiplication operator. More...
 
Matrix6< T > operator*= (const Matrix6< T > &_m2)
 Multiplication assignment operator. This matrix will become equal to this * _m2. More...
 
Matrix6< T > operator+ (const Matrix6< T > &_m2) const
 Addition operator. More...
 
Matrix6< T > operator+= (const Matrix6< T > &_m2)
 Addition assignment operator. This matrix will become equal to this + _m2. More...
 
Matrix6< T > & operator= (const Matrix6< T > &_mat)=default
 Assignment operator. this = _mat. More...
 
bool operator== (const Matrix6< T > &_m) const
 Equality operator. More...
 
void Set (T _v00, T _v01, T _v02, T _v03, T _v04, T _v05, T _v10, T _v11, T _v12, T _v13, T _v14, T _v15, T _v20, T _v21, T _v22, T _v23, T _v24, T _v25, T _v30, T _v31, T _v32, T _v33, T _v34, T _v35, T _v40, T _v41, T _v42, T _v43, T _v44, T _v45, T _v50, T _v51, T _v52, T _v53, T _v54, T _v55)
 Change the values. More...
 
void SetSubmatrix (Matrix6Corner _corner, const Matrix3< T > &_mat)
 Set one of the four 3x3 submatrices that compose this matrix. These submatrices are formed by dividing the 6x6 matrix in 4 parts that do not overlap with each other. More...
 
bool SetValue (size_t _row, size_t _col, T _v)
 Set a value in a specific row and col param[in] _row Row of the matrix param[in] _col Col of the matrix param[in] _v Value to assign. More...
 
Matrix3< T > Submatrix (Matrix6Corner _corner) const
 Get one of the four 3x3 submatrices that compose this matrix. These submatrices are formed by dividing the 6x6 matrix in 4 parts that do not overlap with each other. More...
 
void Transpose ()
 Transpose this matrix. More...
 
Matrix6< T > Transposed () const
 Return the transpose of this matrix. More...
 

Static Public Attributes

static const Matrix6< T > & Identity = detail::gMatrix6Identity<T>
 Identity matrix. More...
 
static constexpr std::size_t MatrixSize {6}
 Size of matrix is fixed to 6x6. More...
 
static const Matrix6< T > & Zero = detail::gMatrix6Zero<T>
 Zero matrix. More...
 

Detailed Description

template<typename T>
class gz::math::Matrix6< T >

A 6x6 matrix class.

Member Enumeration Documentation

◆ Matrix6Corner

Identifiers for each of the 4 3x3 corners of the matrix.

Enumerator
TOP_LEFT 

Top-left corner, consisting of the intersection between the first 3 rows and first 3 columns.

TOP_RIGHT 

Top-right corner, consisting of the intersection between the first 3 rows and last 3 columns.

BOTTOM_LEFT 

Bottom-left corner, consisting of the intersection between the last 3 rows and first 3 columns.

BOTTOM_RIGHT 

Bottom-right corner, consisting of the intersection between the last 3 rows and last 3 columns.

Constructor & Destructor Documentation

◆ Matrix6() [1/3]

Matrix6 ( )
inline

Constructor.

References Matrix6< T >::MatrixSize.

◆ Matrix6() [2/3]

Matrix6 ( const Matrix6< T > &  _m)
default

Copy constructor.

Parameters
_mMatrix to copy

◆ Matrix6() [3/3]

constexpr Matrix6 ( _v00,
_v01,
_v02,
_v03,
_v04,
_v05,
_v10,
_v11,
_v12,
_v13,
_v14,
_v15,
_v20,
_v21,
_v22,
_v23,
_v24,
_v25,
_v30,
_v31,
_v32,
_v33,
_v34,
_v35,
_v40,
_v41,
_v42,
_v43,
_v44,
_v45,
_v50,
_v51,
_v52,
_v53,
_v54,
_v55 
)
inlineconstexpr

Constructor.

Parameters
[in]_v00Row 0, Col 0 value
[in]_v01Row 0, Col 1 value
[in]_v02Row 0, Col 2 value
[in]_v03Row 0, Col 3 value
[in]_v04Row 0, Col 4 value
[in]_v05Row 0, Col 5 value
[in]_v10Row 1, Col 0 value
[in]_v11Row 1, Col 1 value
[in]_v12Row 1, Col 2 value
[in]_v13Row 1, Col 3 value
[in]_v14Row 1, Col 4 value
[in]_v15Row 1, Col 5 value
[in]_v20Row 2, Col 0 value
[in]_v21Row 2, Col 1 value
[in]_v22Row 2, Col 2 value
[in]_v23Row 2, Col 3 value
[in]_v24Row 2, Col 4 value
[in]_v25Row 2, Col 5 value
[in]_v30Row 3, Col 0 value
[in]_v31Row 3, Col 1 value
[in]_v32Row 3, Col 2 value
[in]_v33Row 3, Col 3 value
[in]_v34Row 3, Col 4 value
[in]_v35Row 3, Col 5 value
[in]_v40Row 4, Col 0 value
[in]_v41Row 4, Col 1 value
[in]_v42Row 4, Col 2 value
[in]_v43Row 4, Col 3 value
[in]_v44Row 4, Col 4 value
[in]_v45Row 4, Col 5 value
[in]_v50Row 5, Col 0 value
[in]_v51Row 5, Col 1 value
[in]_v52Row 5, Col 2 value
[in]_v53Row 5, Col 3 value
[in]_v54Row 5, Col 4 value
[in]_v55Row 5, Col 5 value

Member Function Documentation

◆ Equal()

bool Equal ( const Matrix6< T > &  _m,
const T &  _tol 
) const
inline

Equality test with tolerance.

Parameters
[in]_mthe matrix to compare to
[in]_tolequality tolerance.
Returns
true if the elements of the matrices are equal within the tolerence specified by _tol.

Referenced by Matrix6< T >::operator==().

◆ operator!=()

bool operator!= ( const Matrix6< T > &  _m) const
inline

Inequality test operator.

Parameters
[in]_mMatrix6<T> to test
Returns
True if not equal (using the default tolerance of 1e-6)

◆ operator()() [1/2]

T& operator() ( const size_t  _row,
const size_t  _col 
)
inline

Get a mutable version of the value at the specified row, column index.

Parameters
[in]_rowthe row index. Index values are clamped to a range of [0, 5].
[in]_colThe column index. Index values are clamped to a range of [0, 5].
Returns
The value at the specified index

References gz::math::clamp(), gz::math::GZ_FIVE_SIZE_T, and gz::math::GZ_ZERO_SIZE_T.

◆ operator()() [2/2]

const T& operator() ( const size_t  _row,
const size_t  _col 
) const
inline

Get the value at the specified row, column index.

Parameters
[in]_colThe column index. Index values are clamped to a range of [0, 5].
[in]_rowthe row index. Index values are clamped to a range of [0, 5].
Returns
The value at the specified index

References gz::math::clamp(), gz::math::GZ_FIVE_SIZE_T, and gz::math::GZ_ZERO_SIZE_T.

◆ operator*()

Matrix6<T> operator* ( const Matrix6< T > &  _m2) const
inline

Multiplication operator.

Parameters
[in]_m2Incoming matrix
Returns
This matrix * _m2

References Matrix6< T >::MatrixSize.

◆ operator*=()

Matrix6<T> operator*= ( const Matrix6< T > &  _m2)
inline

Multiplication assignment operator. This matrix will become equal to this * _m2.

Parameters
[in]_m2Incoming matrix.
Returns
This matrix * _m2.

◆ operator+()

Matrix6<T> operator+ ( const Matrix6< T > &  _m2) const
inline

Addition operator.

Parameters
[in]_m2Incoming matrix
Returns
This matrix + _m2

◆ operator+=()

Matrix6<T> operator+= ( const Matrix6< T > &  _m2)
inline

Addition assignment operator. This matrix will become equal to this + _m2.

Parameters
[in]_m2Incoming matrix.
Returns
This matrix + _m2.

◆ operator=()

Matrix6<T>& operator= ( const Matrix6< T > &  _mat)
default

Assignment operator. this = _mat.

Parameters
_matIncoming matrix
Returns
itself

◆ operator==()

bool operator== ( const Matrix6< T > &  _m) const
inline

Equality operator.

Parameters
[in]_mMatrix6 to test
Returns
true if the 2 matrices are equal (using the tolerance 1e-6), false otherwise

References Matrix6< T >::Equal().

◆ Set()

void Set ( _v00,
_v01,
_v02,
_v03,
_v04,
_v05,
_v10,
_v11,
_v12,
_v13,
_v14,
_v15,
_v20,
_v21,
_v22,
_v23,
_v24,
_v25,
_v30,
_v31,
_v32,
_v33,
_v34,
_v35,
_v40,
_v41,
_v42,
_v43,
_v44,
_v45,
_v50,
_v51,
_v52,
_v53,
_v54,
_v55 
)
inline

Change the values.

Parameters
[in]_v00Row 0, Col 0 value
[in]_v01Row 0, Col 1 value
[in]_v02Row 0, Col 2 value
[in]_v03Row 0, Col 3 value
[in]_v04Row 0, Col 4 value
[in]_v05Row 0, Col 5 value
[in]_v10Row 1, Col 0 value
[in]_v11Row 1, Col 1 value
[in]_v12Row 1, Col 2 value
[in]_v13Row 1, Col 3 value
[in]_v14Row 1, Col 4 value
[in]_v15Row 1, Col 5 value
[in]_v20Row 2, Col 0 value
[in]_v21Row 2, Col 1 value
[in]_v22Row 2, Col 2 value
[in]_v23Row 2, Col 3 value
[in]_v24Row 2, Col 4 value
[in]_v25Row 2, Col 5 value
[in]_v30Row 3, Col 0 value
[in]_v31Row 3, Col 1 value
[in]_v32Row 3, Col 2 value
[in]_v33Row 3, Col 3 value
[in]_v34Row 3, Col 4 value
[in]_v35Row 3, Col 5 value
[in]_v40Row 4, Col 0 value
[in]_v41Row 4, Col 1 value
[in]_v42Row 4, Col 2 value
[in]_v43Row 4, Col 3 value
[in]_v44Row 4, Col 4 value
[in]_v45Row 4, Col 5 value
[in]_v50Row 5, Col 0 value
[in]_v51Row 5, Col 1 value
[in]_v52Row 5, Col 2 value
[in]_v53Row 5, Col 3 value
[in]_v54Row 5, Col 4 value
[in]_v55Row 5, Col 5 value

◆ SetSubmatrix()

void SetSubmatrix ( Matrix6Corner  _corner,
const Matrix3< T > &  _mat 
)
inline

Set one of the four 3x3 submatrices that compose this matrix. These submatrices are formed by dividing the 6x6 matrix in 4 parts that do not overlap with each other.

Parameters
[in]_cornerWhich corner to set.
[in]_matThe matrix to set.

References Matrix6< T >::BOTTOM_LEFT, Matrix6< T >::BOTTOM_RIGHT, and Matrix6< T >::TOP_RIGHT.

Referenced by Inertial< T >::BodyMatrix().

◆ SetValue()

bool SetValue ( size_t  _row,
size_t  _col,
_v 
)
inline

Set a value in a specific row and col param[in] _row Row of the matrix param[in] _col Col of the matrix param[in] _v Value to assign.

Returns
Tru if the value was setted, False otherwise

References Matrix6< T >::MatrixSize.

◆ Submatrix()

Matrix3<T> Submatrix ( Matrix6Corner  _corner) const
inline

Get one of the four 3x3 submatrices that compose this matrix. These submatrices are formed by dividing the 6x6 matrix in 4 parts that do not overlap with each other.

Parameters
[in]_cornerWhich corner to retrieve.
Returns
A new matrix containing the values of the submatrix.

References Matrix6< T >::BOTTOM_LEFT, Matrix6< T >::BOTTOM_RIGHT, and Matrix6< T >::TOP_RIGHT.

◆ Transpose()

void Transpose ( )
inline

Transpose this matrix.

References std::swap().

◆ Transposed()

Matrix6<T> Transposed ( ) const
inline

Return the transpose of this matrix.

Returns
Transpose of this matrix.

Referenced by Inertial< T >::BodyMatrix().

Member Data Documentation

◆ Identity

const Matrix6< T > & Identity = detail::gMatrix6Identity<T>
static

Identity matrix.

◆ MatrixSize

constexpr std::size_t MatrixSize {6}
staticconstexpr

Size of matrix is fixed to 6x6.

Referenced by Matrix6< T >::Matrix6(), Matrix6< T >::operator*(), and Matrix6< T >::SetValue().

◆ Zero

const Matrix6< T > & Zero = detail::gMatrix6Zero<T>
static

Zero matrix.


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