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.
 
 Matrix6 (const Matrix6< T > &_m)=default
 Copy constructor.
 
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.
 
bool Equal (const Matrix6 &_m, const T &_tol) const
 Equality test with tolerance.
 
bool operator!= (const Matrix6< T > &_m) const
 Inequality test operator.
 
T & operator() (const size_t _row, const size_t _col)
 Get a mutable version of the value at the specified row, column index.
 
const T & operator() (const size_t _row, const size_t _col) const
 Get the value at the specified row, column index.
 
Matrix6< T > operator* (const Matrix6< T > &_m2) const
 Multiplication operator.
 
Matrix6< T > operator*= (const Matrix6< T > &_m2)
 Multiplication assignment operator. This matrix will become equal to this * _m2.
 
Matrix6< T > operator+ (const Matrix6< T > &_m2) const
 Addition operator.
 
Matrix6< T > operator+= (const Matrix6< T > &_m2)
 Addition assignment operator. This matrix will become equal to this + _m2.
 
Matrix6< T > & operator= (const Matrix6< T > &_mat)=default
 Assignment operator. this = _mat.
 
bool operator== (const Matrix6< T > &_m) const
 Equality operator.
 
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.
 
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.
 
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.
 
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.
 
void Transpose ()
 Transpose this matrix.
 
Matrix6< T > Transposed () const
 Return the transpose of this matrix.
 

Static Public Attributes

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

Detailed Description

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

A 6x6 matrix class.

Member Enumeration Documentation

◆ Matrix6Corner

template<typename T >
enum 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]

template<typename T >
Matrix6 ( )
inline

Constructor.

References Matrix6< T >::MatrixSize.

◆ Matrix6() [2/3]

template<typename T >
Matrix6 ( const Matrix6< T > & _m)
default

Copy constructor.

Parameters
_mMatrix to copy

◆ Matrix6() [3/3]

template<typename T >
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 )
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()

template<typename T >
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.

◆ operator!=()

template<typename T >
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]

template<typename T >
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]

template<typename T >
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*()

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

Multiplication operator.

Parameters
[in]_m2Incoming matrix
Returns
This matrix * _m2

◆ operator*=()

template<typename T >
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+()

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

Addition operator.

Parameters
[in]_m2Incoming matrix
Returns
This matrix + _m2

◆ operator+=()

template<typename T >
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=()

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

Assignment operator. this = _mat.

Parameters
_matIncoming matrix
Returns
itself

◆ operator==()

template<typename T >
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

◆ Set()

template<typename T >
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 )
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()

template<typename T >
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.

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

◆ SetValue()

template<typename T >
bool SetValue ( size_t _row,
size_t _col,
T _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

◆ Submatrix()

template<typename T >
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.

◆ Transpose()

template<typename T >
void Transpose ( )
inline

Transpose this matrix.

References std::swap().

◆ Transposed()

template<typename T >
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

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

Identity matrix.

◆ MatrixSize

template<typename T >
constexpr std::size_t MatrixSize {6}
staticconstexpr

Size of matrix is fixed to 6x6.

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

◆ Zero

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

Zero matrix.


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