Loading...
Searching...
No Matches
ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T > Class Template Reference

A 3x3 matrix class. More...

#include <ignition/math/Matrix3.hh>

Public Member Functions

 Matrix3 ()
 Constructor.
 
 Matrix3 (const Matrix3< T > &_m)
 Copy constructor.
 
 Matrix3 (const Quaternion< T > &_q)
 Construct Matrix3 from a quaternion.
 
 Matrix3 (T _v00, T _v01, T _v02, T _v10, T _v11, T _v12, T _v20, T _v21, T _v22)
 Constructor.
 
virtual ~Matrix3 ()
 Desctructor.
 
void Axes (const Vector3< T > &_xAxis, const Vector3< T > &_yAxis, const Vector3< T > &_zAxis)
 Set the matrix from three axis (1 per column)
 
void Axis (const Vector3< T > &_axis, T _angle)
 Set the matrix from an axis and angle.
 
void Col (unsigned int _c, const Vector3< T > &_v)
 Set a column.
 
Determinant () const
 Return the determinant of the matrix.
 
bool Equal (const Matrix3 &_m, const T &_tol) const
 Equality test with tolerance.
 
void From2Axes (const Vector3< T > &_v1, const Vector3< T > &_v2)
 Set the matrix to represent rotation from vector _v1 to vector _v2, so that _v2.Normalize() == this * _v1.Normalize() holds.
 
Matrix3< T > Inverse () const
 Return the inverse matrix.
 
bool operator!= (const Matrix3< T > &_m) const
 Inequality test operator.
 
T & operator() (size_t _row, size_t _col)
 Array subscript operator.
 
const T & operator() (size_t _row, size_t _col) const
 Array subscript operator.
 
Matrix3< T > operator* (const Matrix3< T > &_m) const
 Matrix multiplication operator.
 
Matrix3< T > operator* (const T &_s) const
 returns the element wise scalar multiplication
 
Vector3< T > operator* (const Vector3< T > &_vec) const
 Multiplication operator with Vector3 on the right treated like a column vector.
 
Matrix3< T > operator+ (const Matrix3< T > &_m) const
 returns the element wise sum of two matrices
 
Matrix3< T > operator- (const Matrix3< T > &_m) const
 returns the element wise difference of two matrices
 
Matrix3< T > & operator= (const Matrix3< T > &_mat)
 Equal operator.
 
Matrix3< T > & operator= (const Quaternion< T > &_q)
 Set the matrix3 from a quaternion.
 
bool operator== (const Matrix3< T > &_m) const
 Equality test operator.
 
void Set (T _v00, T _v01, T _v02, T _v10, T _v11, T _v12, T _v20, T _v21, T _v22)
 Set values.
 
void Transpose ()
 Transpose this matrix.
 
Matrix3< T > Transposed () const
 Return the transpose of this matrix.
 

Static Public Attributes

static const Matrix3< T > Identity
 Identity matrix.
 
static const Matrix3< T > Zero
 Zero matrix.
 

Detailed Description

template<typename T>
class ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >

A 3x3 matrix class.

Constructor & Destructor Documentation

◆ Matrix3() [1/4]

◆ Matrix3() [2/4]

template<typename T >
ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Matrix3 ( const Matrix3< T > & _m)
inline

Copy constructor.

Parameters
_mMatrix to copy

◆ Matrix3() [3/4]

template<typename T >
ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Matrix3 ( T _v00,
T _v01,
T _v02,
T _v10,
T _v11,
T _v12,
T _v20,
T _v21,
T _v22 )
inline

Constructor.

Parameters
[in]_v00Row 0, Col 0 value
[in]_v01Row 0, Col 1 value
[in]_v02Row 0, Col 2 value
[in]_v10Row 1, Col 0 value
[in]_v11Row 1, Col 1 value
[in]_v12Row 1, Col 2 value
[in]_v20Row 2, Col 0 value
[in]_v21Row 2, Col 1 value
[in]_v22Row 2, Col 2 value

◆ Matrix3() [4/4]

◆ ~Matrix3()

template<typename T >
virtual ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::~Matrix3 ( )
inlinevirtual

Desctructor.

Member Function Documentation

◆ Axes()

template<typename T >
void ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Axes ( const Vector3< T > & _xAxis,
const Vector3< T > & _yAxis,
const Vector3< T > & _zAxis )
inline

Set the matrix from three axis (1 per column)

Parameters
[in]_xAxisThe x axis
[in]_yAxisThe y axis
[in]_zAxisThe z axis

References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Col().

◆ Axis()

template<typename T >
void ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Axis ( const Vector3< T > & _axis,
T _angle )
inline

◆ Col()

template<typename T >
void ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Col ( unsigned int _c,
const Vector3< T > & _v )
inline

◆ Determinant()

template<typename T >
T ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Determinant ( ) const
inline

Return the determinant of the matrix.

Returns
Determinant of this matrix.

◆ Equal()

template<typename T >
bool ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Equal ( const Matrix3< 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.

References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::equal().

Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::operator==().

◆ From2Axes()

◆ Inverse()

template<typename T >
Matrix3< T > ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Inverse ( ) const
inline

Return the inverse matrix.

Returns
Inverse of this matrix.

References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Matrix3().

◆ operator!=()

template<typename T >
bool ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::operator!= ( const Matrix3< T > & _m) const
inline

Inequality test operator.

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

◆ operator()() [1/2]

template<typename T >
T & ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::operator() ( size_t _row,
size_t _col )
inline

Array subscript operator.

Parameters
[in]_rowrow index. _row is clamped to the range [0,2]
[in]_colcolumn index. _col is clamped to the range [0,2]
Returns
a pointer to the row

References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::clamp(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::IGN_TWO_SIZE_T, and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::IGN_ZERO_SIZE_T.

◆ operator()() [2/2]

template<typename T >
const T & ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::operator() ( size_t _row,
size_t _col ) const
inline

Array subscript operator.

Parameters
[in]_rowrow index. _row is clamped to the range [0,2]
[in]_colcolumn index. _col is clamped to the range [0,2]
Returns
a pointer to the row

References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::clamp(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::IGN_TWO_SIZE_T, and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::IGN_ZERO_SIZE_T.

◆ operator*() [1/3]

template<typename T >
Matrix3< T > ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::operator* ( const Matrix3< T > & _m) const
inline

Matrix multiplication operator.

Parameters
[in]_mMatrix3<T> to multiply
Returns
product of this * _m

References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Matrix3().

◆ operator*() [2/3]

template<typename T >
Matrix3< T > ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::operator* ( const T & _s) const
inline

returns the element wise scalar multiplication

References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Matrix3().

◆ operator*() [3/3]

template<typename T >
Vector3< T > ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::operator* ( const Vector3< T > & _vec) const
inline

Multiplication operator with Vector3 on the right treated like a column vector.

Parameters
_vecVector3
Returns
Resulting vector from multiplication

References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector3< T >::X(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector3< T >::Y(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector3< T >::Z().

◆ operator+()

template<typename T >
Matrix3< T > ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::operator+ ( const Matrix3< T > & _m) const
inline

returns the element wise sum of two matrices

References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Matrix3().

◆ operator-()

template<typename T >
Matrix3< T > ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::operator- ( const Matrix3< T > & _m) const
inline

returns the element wise difference of two matrices

References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Matrix3().

◆ operator=() [1/2]

template<typename T >
Matrix3< T > & ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::operator= ( const Matrix3< T > & _mat)
inline

Equal operator.

this = _mat

Parameters
_matIncoming matrix
Returns
itself

◆ operator=() [2/2]

template<typename T >
Matrix3< T > & ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::operator= ( const Quaternion< T > & _q)
inline

Set the matrix3 from a quaternion.

Parameters
[in]_qQuaternion to set the matrix3 from.
Returns
Reference to the new matrix3 object.

References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Matrix3().

◆ operator==()

template<typename T >
bool ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::operator== ( const Matrix3< T > & _m) const
inline

Equality test operator.

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

References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Equal().

◆ Set()

template<typename T >
void ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Set ( T _v00,
T _v01,
T _v02,
T _v10,
T _v11,
T _v12,
T _v20,
T _v21,
T _v22 )
inline

Set values.

Parameters
[in]_v00Row 0, Col 0 value
[in]_v01Row 0, Col 1 value
[in]_v02Row 0, Col 2 value
[in]_v10Row 1, Col 0 value
[in]_v11Row 1, Col 1 value
[in]_v12Row 1, Col 2 value
[in]_v20Row 2, Col 0 value
[in]_v21Row 2, Col 1 value
[in]_v22Row 2, Col 2 value

Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Matrix3(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::From2Axes().

◆ Transpose()

template<typename T >
void ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Transpose ( )
inline

Transpose this matrix.

◆ Transposed()

Member Data Documentation

◆ Identity

template<typename T >
const Matrix3< T > ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Identity
static

Identity matrix.

◆ Zero

template<typename T >
const Matrix3< T > ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Zero
static

Zero matrix.


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