Matrix3 Class Reference

A 3x3 matrix class. More...

#include <Matrix3.hh>

Public Member Functions

 Matrix3 ()
 Constructor. More...
 
 Matrix3 (const Matrix3 &_m)
 Copy constructor. More...
 
 Matrix3 (double _v00, double _v01, double _v02, double _v10, double _v11, double _v12, double _v20, double _v21, double _v22)
 Constructor. More...
 
virtual ~Matrix3 ()
 Desctructor. More...
 
Matrix3 Inverse () const
 Return the inverse matrix. More...
 
Matrix3 operator* (const double &_s) const
 returns the element wise scalar multiplication More...
 
Matrix3 operator* (const Matrix3 &_m) const
 Matrix multiplication operator. More...
 
math::Vector3 operator* (const math::Vector3 &_v) const
 Matrix times Vector3 operator. More...
 
Matrix3 operator+ (const Matrix3 &_m) const
 returns the element wise sum of two matrices More...
 
Matrix3 operator- (const Matrix3 &_m) const
 returns the element wise difference of two matrices More...
 
bool operator== (const Matrix3 &_m) const
 Equality test operator. More...
 
const double * operator[] (size_t _row) const
 Array subscript operator. More...
 
double * operator[] (size_t _row)
 Array subscript operator. More...
 
void SetCol (unsigned int _c, const Vector3 &_v)
 Set a column. More...
 
void SetFromAxes (const Vector3 &_xAxis, const Vector3 &_yAxis, const Vector3 &_zAxis)
 Set the matrix from three axis (1 per column) More...
 
void SetFromAxis (const Vector3 &_axis, double _angle)
 Set the matrix from an axis and angle. More...
 

Static Public Attributes

static const Matrix3 IDENTITY
 Identity matrix. More...
 
static const Matrix3 ZERO
 Zero matrix. More...
 

Protected Attributes

double m [3][3]
 the 3x3 matrix More...
 

Friends

Matrix3 operator* (double _s, const Matrix3 &_m)
 Multiplication operators. More...
 
std::ostream & operator<< (std::ostream &_out, const gazebo::math::Matrix3 &_m)
 Stream insertion operator. More...
 

Detailed Description

A 3x3 matrix class.

Constructor & Destructor Documentation

Matrix3 ( const Matrix3 _m)

Copy constructor.

Parameters
_mMatrix to copy
Matrix3 ( double  _v00,
double  _v01,
double  _v02,
double  _v10,
double  _v11,
double  _v12,
double  _v20,
double  _v21,
double  _v22 
)

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
virtual ~Matrix3 ( )
virtual

Desctructor.

Member Function Documentation

Matrix3 Inverse ( ) const

Return the inverse matrix.

Returns
Inverse of this matrix.
Matrix3 operator* ( const double &  _s) const
inline

returns the element wise scalar multiplication

References Matrix3::m, and Matrix3::Matrix3().

Matrix3 operator* ( const Matrix3 _m) const
inline

Matrix multiplication operator.

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

References Matrix3::m, and Matrix3::Matrix3().

math::Vector3 operator* ( const math::Vector3 _v) const
inline

Matrix times Vector3 operator.

Parameters
[in]_va Vector3
Returns
this * _v

References Matrix3::m, Vector3::x, Vector3::y, and Vector3::z.

Matrix3 operator+ ( const Matrix3 _m) const
inline

returns the element wise sum of two matrices

References Matrix3::m, and Matrix3::Matrix3().

Matrix3 operator- ( const Matrix3 _m) const
inline

returns the element wise difference of two matrices

References Matrix3::m, and Matrix3::Matrix3().

bool operator== ( const Matrix3 _m) const

Equality test operator.

Parameters
[in]_mMatrix3 to test
Returns
True if equal (using the default tolerance of 1e-6)
const double* operator[] ( size_t  _row) const
inline

Array subscript operator.

Parameters
[in]_rowrow index
Returns
a pointer to the row

References Matrix3::m.

double* operator[] ( size_t  _row)
inline

Array subscript operator.

Parameters
[in]_rowrow index
Returns
a pointer to the row

References Matrix3::m.

void SetCol ( unsigned int  _c,
const Vector3 _v 
)

Set a column.

Parameters
[in]_cThe colum index (0, 1, 2)
[in]_vThe value to set in each row of the column
void SetFromAxes ( const Vector3 _xAxis,
const Vector3 _yAxis,
const Vector3 _zAxis 
)

Set the matrix from three axis (1 per column)

Parameters
[in]_xAxisThe x axis
[in]_yAxisThe y axis
[in]_zAxisThe z axis
void SetFromAxis ( const Vector3 _axis,
double  _angle 
)

Set the matrix from an axis and angle.

Parameters
[in]_axisthe axis
[in]_angleccw rotation around the axis in radians

Friends And Related Function Documentation

Matrix3 operator* ( double  _s,
const Matrix3 _m 
)
friend

Multiplication operators.

Parameters
[in]_sthe scaling factor
[in]_minput matrix
Returns
a scaled matrix
std::ostream& operator<< ( std::ostream &  _out,
const gazebo::math::Matrix3 _m 
)
friend

Stream insertion operator.

Parameters
[in]_outOutput stream
[in]_mMatrix to output
Returns
the stream

Member Data Documentation

const Matrix3 IDENTITY
static

Identity matrix.

double m[3][3]
protected
const Matrix3 ZERO
static

Zero matrix.


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