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. | |
T | 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. | |
A 3x3 matrix class.
|
inline |
Constructor.
Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Inverse(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::operator*(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::operator*(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::operator+(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::operator-(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::operator=(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Transposed().
|
inline |
Copy constructor.
_m | Matrix to copy |
|
inline |
Constructor.
[in] | _v00 | Row 0, Col 0 value |
[in] | _v01 | Row 0, Col 1 value |
[in] | _v02 | Row 0, Col 2 value |
[in] | _v10 | Row 1, Col 0 value |
[in] | _v11 | Row 1, Col 1 value |
[in] | _v12 | Row 1, Col 2 value |
[in] | _v20 | Row 2, Col 0 value |
[in] | _v21 | Row 2, Col 1 value |
[in] | _v22 | Row 2, Col 2 value |
|
inlineexplicit |
Construct Matrix3 from a quaternion.
[in] | _q | Quaternion. |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Quaternion< T >::Normalize(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Set(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Quaternion< T >::W(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Quaternion< T >::X(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Quaternion< T >::Y(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Quaternion< T >::Z().
|
inlinevirtual |
Desctructor.
|
inline |
Set the matrix from three axis (1 per column)
[in] | _xAxis | The x axis |
[in] | _yAxis | The y axis |
[in] | _zAxis | The z axis |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Col().
|
inline |
Set the matrix from an axis and angle.
[in] | _axis | the axis |
[in] | _angle | ccw rotation around the axis in radians |
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().
Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::From2Axes().
|
inline |
Set a column.
[in] | _c | The colum index [0, 1, 2]. _col is clamped to the range [0, 2]. |
[in] | _v | The value to set in each row of the column. |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::clamp(), 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().
Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Axes().
|
inline |
Return the determinant of the matrix.
|
inline |
Equality test with tolerance.
[in] | _m | the matrix to compare to |
[in] | _tol | equality tolerance. |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::equal().
Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::operator==().
|
inline |
Set the matrix to represent rotation from vector _v1 to vector _v2, so that _v2.Normalize() == this * _v1.Normalize() holds.
[in] | _v1 | The first vector |
[in] | _v2 | The second vector |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Axis(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector3< T >::Cross(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector3< T >::Dot(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector3< T >::Normalize(), ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Set(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Vector3< T >::SquaredLength().
|
inline |
Return the inverse matrix.
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Matrix3().
|
inline |
Inequality test operator.
[in] | _m | Matrix3<T> to test |
|
inline |
Array subscript operator.
[in] | _row | row index. _row is clamped to the range [0,2] |
[in] | _col | column index. _col is clamped to the range [0,2] |
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.
|
inline |
Array subscript operator.
[in] | _row | row index. _row is clamped to the range [0,2] |
[in] | _col | column index. _col is clamped to the range [0,2] |
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.
|
inline |
Matrix multiplication operator.
[in] | _m | Matrix3<T> to multiply |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Matrix3().
|
inline |
returns the element wise scalar multiplication
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Matrix3().
|
inline |
Multiplication operator with Vector3 on the right treated like a column vector.
_vec | Vector3 |
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().
|
inline |
returns the element wise sum of two matrices
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Matrix3().
|
inline |
returns the element wise difference of two matrices
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Matrix3().
|
inline |
Equal operator.
this = _mat
_mat | Incoming matrix |
|
inline |
Set the matrix3 from a quaternion.
[in] | _q | Quaternion to set the matrix3 from. |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Matrix3().
|
inline |
Equality test operator.
[in] | _m | Matrix3<T> to test |
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Equal().
|
inline |
Set values.
[in] | _v00 | Row 0, Col 0 value |
[in] | _v01 | Row 0, Col 1 value |
[in] | _v02 | Row 0, Col 2 value |
[in] | _v10 | Row 1, Col 0 value |
[in] | _v11 | Row 1, Col 1 value |
[in] | _v12 | Row 1, Col 2 value |
[in] | _v20 | Row 2, Col 0 value |
[in] | _v21 | Row 2, Col 1 value |
[in] | _v22 | Row 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().
|
inline |
Transpose this matrix.
|
inline |
Return the transpose of this matrix.
References ignition::math::IGNITION_MATH_VERSION_NAMESPACE::Matrix3< T >::Matrix3().
Referenced by ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::SetFromBox(), and ignition::math::IGNITION_MATH_VERSION_NAMESPACE::MassMatrix3< T >::SetFromCylinderZ().
|
static |
Identity matrix.
|
static |
Zero matrix.