All Classes Namespaces Files Functions Variables Typedefs Friends Macros Pages
Public Member Functions | Static Public Attributes | Friends | List of all members
ignition::math::Matrix4< T > Class Template Reference

A 4x4 matrix class. More...

#include <ignition/math/Matrix4.hh>

Public Member Functions

 Matrix4 ()
 Constructor. More...
 
 Matrix4 (const Matrix4< T > &_m)
 Copy constructor. More...
 
 Matrix4 (T _v00, T _v01, T _v02, T _v03, T _v10, T _v11, T _v12, T _v13, T _v20, T _v21, T _v22, T _v23, T _v30, T _v31, T _v32, T _v33)
 Constructor. More...
 
 Matrix4 (const Quaternion< T > &_q)
 Construct Matrix4 from a quaternion. More...
 
virtual ~Matrix4 ()
 Destructor. More...
 
void Axis (const Vector3< T > &_axis, T _angle)
 Set the upper-left 3x3 matrix from an axis and angle. More...
 
Vector3< T > EulerRotation (bool _firstSolution) const
 Get the rotation as a Euler angles. More...
 
Matrix4< T > Inverse () const
 Return the inverse matrix. More...
 
bool IsAffine () const
 Return true if the matrix is affine. More...
 
bool operator!= (const Matrix4< T > &_m) const
 Inequality test operator. More...
 
const T & operator() (size_t _row, size_t _col) const
 Get the value at the specified row, column index. More...
 
T & operator() (size_t _row, size_t _col)
 Get a mutable version the value at the specified row, column index. More...
 
Matrix4< T > operator* (const Matrix4< T > &_m2) const
 Multiplication operator. More...
 
Vector3< T > operator* (const Vector3< T > &_vec) const
 Multiplication operator. More...
 
Matrix4< T > & operator= (const Matrix4< T > &_mat)
 Equal operator. More...
 
const Matrix4< T > & operator= (const Matrix3< T > &_mat)
 Equal operator for 3x3 matrix. More...
 
bool operator== (const Matrix4< T > &_m) const
 Equality operator. More...
 
Pose3< T > Pose () const
 Get the transformation as math::Pose. More...
 
Quaternion< T > Rotation () const
 Get the rotation as a quaternion. More...
 
Vector3< T > Scale () const
 Get the scale values as a Vector3<T> More...
 
void Scale (const Vector3< T > &_s)
 Set the scale. More...
 
void Scale (T _x, T _y, T _z)
 Set the scale. More...
 
void Set (T _v00, T _v01, T _v02, T _v03, T _v10, T _v11, T _v12, T _v13, T _v20, T _v21, T _v22, T _v23, T _v30, T _v31, T _v32, T _v33)
 Change the values. More...
 
Vector3< T > TransformAffine (const Vector3< T > &_v) const
 Perform an affine transformation. More...
 
void Translate (const Vector3< T > &_t)
 Set the translational values [ (0, 3) (1, 3) (2, 3) ]. More...
 
void Translate (T _x, T _y, T _z)
 Set the translational values [ (0, 3) (1, 3) (2, 3) ]. More...
 
Vector3< T > Translation () const
 Get the translational values as a Vector3. More...
 

Static Public Attributes

static const Matrix4< T > Identity
 Identity matrix. More...
 
static const Matrix4< T > Zero
 Zero matrix. More...
 

Friends

std::ostream & operator<< (std::ostream &_out, const ignition::math::Matrix4< T > &_m)
 Stream insertion operator. More...
 
std::istream & operator>> (std::istream &_in, ignition::math::Matrix4< T > &_m)
 Stream extraction operator. More...
 

Detailed Description

template<typename T>
class ignition::math::Matrix4< T >

A 4x4 matrix class.

Constructor & Destructor Documentation

template<typename T>
ignition::math::Matrix4< T >::Matrix4 ( )
inline

Constructor.

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

Copy constructor.

Parameters
_mMatrix to copy
template<typename T>
ignition::math::Matrix4< T >::Matrix4 ( _v00,
_v01,
_v02,
_v03,
_v10,
_v11,
_v12,
_v13,
_v20,
_v21,
_v22,
_v23,
_v30,
_v31,
_v32,
_v33 
)
inline

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]_v10Row 1, Col 0 value
[in]_v11Row 1, Col 1 value
[in]_v12Row 1, Col 2 value
[in]_v13Row 1, Col 3 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]_v30Row 3, Col 0 value
[in]_v31Row 3, Col 1 value
[in]_v32Row 3, Col 2 value
[in]_v33Row 3, Col 3 value
template<typename T>
ignition::math::Matrix4< T >::Matrix4 ( const Quaternion< T > &  _q)
inline

Construct Matrix4 from a quaternion.

Parameters
[in]_qQuaternion.
template<typename T>
virtual ignition::math::Matrix4< T >::~Matrix4 ( )
inlinevirtual

Destructor.

Member Function Documentation

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

Set the upper-left 3x3 matrix from an axis and angle.

Parameters
[in]_axisthe axis
[in]_angleccw rotation around the axis in radians
template<typename T>
Vector3<T> ignition::math::Matrix4< T >::EulerRotation ( bool  _firstSolution) const
inline

Get the rotation as a Euler angles.

Parameters
[in]_firstSolutionTrue to get the first Euler solution, false to get the second.
Returns
the rotation
template<typename T>
Matrix4<T> ignition::math::Matrix4< T >::Inverse ( ) const
inline

Return the inverse matrix.

This is a non-destructive operation.

Returns
Inverse of this matrix.
template<typename T>
bool ignition::math::Matrix4< T >::IsAffine ( ) const
inline

Return true if the matrix is affine.

Returns
true if the matrix is affine, false otherwise

Referenced by ignition::math::Matrix4< double >::TransformAffine().

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

Inequality test operator.

Parameters
[in]_mMatrix4<T> to test
Returns
True if not equal (using the default tolerance of 1e-6)
template<typename T>
const T& ignition::math::Matrix4< T >::operator() ( size_t  _row,
size_t  _col 
) const
inline

Get the value at the specified row, column index.

Parameters
[in]_colThe column index
[in]_rowthe row index
Returns
The value at the specified index
template<typename T>
T& ignition::math::Matrix4< T >::operator() ( size_t  _row,
size_t  _col 
)
inline

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

Parameters
[in]_colThe column index
[in]_rowThe row index
Returns
The value at the specified index
template<typename T>
Matrix4<T> ignition::math::Matrix4< T >::operator* ( const Matrix4< T > &  _m2) const
inline

Multiplication operator.

Parameters
_matIncoming matrix
Returns
This matrix * _mat
template<typename T>
Vector3<T> ignition::math::Matrix4< T >::operator* ( const Vector3< T > &  _vec) const
inline

Multiplication operator.

Parameters
_vecVector3
Returns
Resulting vector from multiplication
template<typename T>
Matrix4<T>& ignition::math::Matrix4< T >::operator= ( const Matrix4< T > &  _mat)
inline

Equal operator.

this = _mat

Parameters
_matIncoming matrix
Returns
itself
template<typename T>
const Matrix4<T>& ignition::math::Matrix4< T >::operator= ( const Matrix3< T > &  _mat)
inline

Equal operator for 3x3 matrix.

Parameters
_matIncoming matrix
Returns
itself
template<typename T>
bool ignition::math::Matrix4< T >::operator== ( const Matrix4< T > &  _m) const
inline

Equality operator.

Parameters
[in]_mMatrix3 to test
Returns
true if the 2 matrices are equal (using the tolerance 1e-6), false otherwise
template<typename T>
Pose3<T> ignition::math::Matrix4< T >::Pose ( ) const
inline

Get the transformation as math::Pose.

Returns
the pose
template<typename T>
Quaternion<T> ignition::math::Matrix4< T >::Rotation ( ) const
inline

Get the rotation as a quaternion.

Returns
the rotation

algorithm from Ogre::Quaternion<T> source, which in turn is based on Ken Shoemake's article "Quaternion<T> Calculus and Fast Animation".

Referenced by ignition::math::Matrix4< double >::Pose().

template<typename T>
Vector3<T> ignition::math::Matrix4< T >::Scale ( ) const
inline

Get the scale values as a Vector3<T>

Returns
x,y,z scale values
template<typename T>
void ignition::math::Matrix4< T >::Scale ( const Vector3< T > &  _s)
inline

Set the scale.

Parameters
[in]_sscale
template<typename T>
void ignition::math::Matrix4< T >::Scale ( _x,
_y,
_z 
)
inline

Set the scale.

Parameters
[in]_xX scale value.
[in]_yY scale value.
[in]_zZ scale value.
template<typename T>
void ignition::math::Matrix4< T >::Set ( _v00,
_v01,
_v02,
_v03,
_v10,
_v11,
_v12,
_v13,
_v20,
_v21,
_v22,
_v23,
_v30,
_v31,
_v32,
_v33 
)
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]_v10Row 1, Col 0 value
[in]_v11Row 1, Col 1 value
[in]_v12Row 1, Col 2 value
[in]_v13Row 1, Col 3 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]_v30Row 3, Col 0 value
[in]_v31Row 3, Col 1 value
[in]_v32Row 3, Col 2 value
[in]_v33Row 3, Col 3 value

Referenced by ignition::math::Matrix4< double >::Matrix4().

template<typename T>
Vector3<T> ignition::math::Matrix4< T >::TransformAffine ( const Vector3< T > &  _v) const
inline

Perform an affine transformation.

Parameters
_vVector3 value for the transformation
Returns
The result of the transformation
Exceptions
AffineExceptionwhen matrix is not affine.
template<typename T>
void ignition::math::Matrix4< T >::Translate ( const Vector3< T > &  _t)
inline

Set the translational values [ (0, 3) (1, 3) (2, 3) ].

Parameters
[in]_tValues to set
template<typename T>
void ignition::math::Matrix4< T >::Translate ( _x,
_y,
_z 
)
inline

Set the translational values [ (0, 3) (1, 3) (2, 3) ].

Parameters
[in]_xX translation value.
[in]_yY translation value.
[in]_zZ translation value.
template<typename T>
Vector3<T> ignition::math::Matrix4< T >::Translation ( ) const
inline

Get the translational values as a Vector3.

Returns
x,y,z translation values

Referenced by ignition::math::Matrix4< double >::Pose().

Friends And Related Function Documentation

template<typename T>
std::ostream& operator<< ( std::ostream &  _out,
const ignition::math::Matrix4< T > &  _m 
)
friend

Stream insertion operator.

Parameters
_outoutput stream
_mMatrix to output
Returns
the stream
template<typename T>
std::istream& operator>> ( std::istream &  _in,
ignition::math::Matrix4< T > &  _m 
)
friend

Stream extraction operator.

Parameters
_ininput stream
_ptMatrix4<T> to read values into
Returns
the stream

Member Data Documentation

template<typename T>
const Matrix4< T > ignition::math::Matrix4< T >::Identity
static

Identity matrix.

template<typename T>
const Matrix4< T > ignition::math::Matrix4< T >::Zero
static

Zero matrix.


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