A quaternion, which can represent a 3D rotation as pair
, with a real part "r" and a 3D vector
, or alternatively, q = r + ix + jy + kz.
The elements of the quaternion can be accessed by either:
Users will usually employ the typedef "CQuaternionDouble" instead of this template.
For more information about quaternions, see:
#include <mrpt/math/CQuaternion.h>

Public Member Functions | |
| CQuaternion (TConstructorFlags_Quaternions constructor_dummy_param) | |
| Can be used with UNINITIALIZED_QUATERNION as argument, does not initialize the 4 elements of the quaternion (use this constructor when speed is critical). | |
| CQuaternion () | |
| Default constructor: construct a (1, (0,0,0) ) quaternion representing no rotation. | |
| CQuaternion (const T r, const T x, const T y, const T z) | |
| Construct a quaternion from its parameters 'r', 'x', 'y', 'z', with q = r + ix + jy + kz. | |
| T | r () const |
| Return r coordinate of the quaternion. | |
| T | x () const |
| Return x coordinate of the quaternion. | |
| T | y () const |
| Return y coordinate of the quaternion. | |
| T | z () const |
| Return z coordinate of the quaternion. | |
| void | r (const T r) |
| Set r coordinate of the quaternion. | |
| void | x (const T x) |
| Set x coordinate of the quaternion. | |
| void | y (const T y) |
| Set y coordinate of the quaternion. | |
| void | z (const T z) |
| Set z coordinate of the quaternion. | |
| template<class ARRAYLIKE > | |
| void | fromRodriguesVector (const ARRAYLIKE &in) |
| Set this quaternion to the rotation described by a 3D Rodrigues rotation vector. | |
| void | crossProduct (const CQuaternion &q1, const CQuaternion &q2) |
| Calculate the "cross" product (or "composed rotation") of two quaternion: this = q1 x q2 After the operation, "this" will represent the composed rotations of q1 and q2 (q2 applied "after" q1). | |
| void | rotatePoint (const double lx, const double ly, const double lz, double &gx, double &gy, double &gz) const |
| Rotate a 3D point (lx,ly,lz) -> (gx,gy,gz) as described by this quaternion. | |
| void | inverseRotatePoint (const double lx, const double ly, const double lz, double &gx, double &gy, double &gz) const |
| Rotate a 3D point (lx,ly,lz) -> (gx,gy,gz) as described by the inverse (conjugate) of this quaternion. | |
| double | normSqr () const |
| Return the squared norm of the quaternion. | |
| void | normalize () |
| Normalize this quaternion, so its norm becomes the unitity. | |
| template<class MATRIXLIKE > | |
| void | normalizationJacobian (MATRIXLIKE &J) const |
| Calculate the 4x4 Jacobian of the normalization operation of this quaternion. | |
| template<class MATRIXLIKE > | |
| void | rotationJacobian (MATRIXLIKE &J) const |
Compute the Jacobian of the rotation composition operation , that is the 4x4 matrix . | |
| template<class MATRIXLIKE > | |
| void | rotationMatrix (MATRIXLIKE &M) const |
| Calculate the 3x3 rotation matrix associated to this quaternion. | |
| template<class MATRIXLIKE > | |
| void | rotationMatrixNoResize (MATRIXLIKE &M) const |
| Fill out the top-left 3x3 block of the given matrix with the rotation matrix associated to this quaternion (does not resize the matrix, for that, see rotationMatrix) | |
| void | conj (CQuaternion &q_out) const |
| Return the conjugate quaternion. | |
| CQuaternion | conj () const |
| Return the conjugate quaternion. | |
| void | rpy (T &roll, T &pitch, T &yaw) const |
| Return the yaw, pitch & roll angles associated to quaternion. | |
| template<class MATRIXLIKE > | |
| void | rpy_and_jacobian (T &roll, T &pitch, T &yaw, MATRIXLIKE *out_dr_dq=NULL, bool resize_out_dr_dq_to3x4=true) const |
| Return the yaw, pitch & roll angles associated to quaternion, and (optionally) the 3x4 Jacobian of the transformation. | |
| CQuaternion | operator* (const T &factor) |
Private Types | |
| typedef CArrayNumeric< T, 4 > | Base |
typedef CArrayNumeric<T,4> mrpt::math::CQuaternion::Base [private] |
Reimplemented from mrpt::math::CArrayNumeric< T, 4 >.
Definition at line 63 of file CQuaternion.h.
| mrpt::math::CQuaternion::CQuaternion | ( | TConstructorFlags_Quaternions | constructor_dummy_param | ) | [inline] |
Can be used with UNINITIALIZED_QUATERNION as argument, does not initialize the 4 elements of the quaternion (use this constructor when speed is critical).
Definition at line 69 of file CQuaternion.h.
| mrpt::math::CQuaternion::CQuaternion | ( | ) | [inline] |
Default constructor: construct a (1, (0,0,0) ) quaternion representing no rotation.
Definition at line 72 of file CQuaternion.h.
| mrpt::math::CQuaternion::CQuaternion | ( | const T | r, |
| const T | x, | ||
| const T | y, | ||
| const T | z | ||
| ) | [inline] |
Construct a quaternion from its parameters 'r', 'x', 'y', 'z', with q = r + ix + jy + kz.
Definition at line 81 of file CQuaternion.h.
| void mrpt::math::CQuaternion::conj | ( | CQuaternion & | q_out | ) | const [inline] |
Return the conjugate quaternion.
Definition at line 240 of file CQuaternion.h.
| CQuaternion mrpt::math::CQuaternion::conj | ( | ) | const [inline] |
Return the conjugate quaternion.
Definition at line 249 of file CQuaternion.h.
Referenced by mrpt::math::CQuaternion< double >::conj().
| void mrpt::math::CQuaternion::crossProduct | ( | const CQuaternion & | q1, |
| const CQuaternion & | q2 | ||
| ) | [inline] |
Calculate the "cross" product (or "composed rotation") of two quaternion: this = q1 x q2 After the operation, "this" will represent the composed rotations of q1 and q2 (q2 applied "after" q1).
Definition at line 135 of file CQuaternion.h.
| void mrpt::math::CQuaternion::fromRodriguesVector | ( | const ARRAYLIKE & | in | ) | [inline] |
Set this quaternion to the rotation described by a 3D Rodrigues rotation vector.
Definition at line 106 of file CQuaternion.h.
| void mrpt::math::CQuaternion::inverseRotatePoint | ( | const double | lx, |
| const double | ly, | ||
| const double | lz, | ||
| double & | gx, | ||
| double & | gy, | ||
| double & | gz | ||
| ) | const [inline] |
Rotate a 3D point (lx,ly,lz) -> (gx,gy,gz) as described by the inverse (conjugate) of this quaternion.
Definition at line 157 of file CQuaternion.h.
| void mrpt::math::CQuaternion::normalizationJacobian | ( | MATRIXLIKE & | J | ) | const [inline] |
Calculate the 4x4 Jacobian of the normalization operation of this quaternion.
The output matrix can be a dynamic or fixed size (4x4) matrix.
Definition at line 182 of file CQuaternion.h.
| void mrpt::math::CQuaternion::normalize | ( | ) | [inline] |
Normalize this quaternion, so its norm becomes the unitity.
Definition at line 171 of file CQuaternion.h.
Referenced by mrpt::math::CQuaternion< double >::crossProduct().
| double mrpt::math::CQuaternion::normSqr | ( | ) | const [inline] |
Return the squared norm of the quaternion.
Definition at line 167 of file CQuaternion.h.
Referenced by mrpt::math::CQuaternion< double >::CQuaternion(), mrpt::math::CQuaternion< double >::normalize(), and mrpt::math::CQuaternion< double >::normalizationJacobian().
| CQuaternion mrpt::math::CQuaternion::operator* | ( | const T & | factor | ) | [inline] |
Definition at line 341 of file CQuaternion.h.
| T mrpt::math::CQuaternion::r | ( | ) | const [inline] |
Return r coordinate of the quaternion.
Definition at line 94 of file CQuaternion.h.
Referenced by mrpt::math::CQuaternion< double >::CQuaternion(), mrpt::math::CQuaternion< double >::crossProduct(), mrpt::math::CQuaternion< double >::rotatePoint(), mrpt::math::CQuaternion< double >::inverseRotatePoint(), mrpt::math::CQuaternion< double >::normSqr(), mrpt::math::CQuaternion< double >::normalizationJacobian(), mrpt::math::CQuaternion< double >::rotationJacobian(), mrpt::math::CQuaternion< double >::rotationMatrixNoResize(), mrpt::math::CQuaternion< double >::conj(), and mrpt::math::CQuaternion< double >::rpy_and_jacobian().
| void mrpt::math::CQuaternion::r | ( | const T | r | ) | [inline] |
Set r coordinate of the quaternion.
Definition at line 98 of file CQuaternion.h.
Referenced by mrpt::math::CQuaternion< double >::r().
| void mrpt::math::CQuaternion::rotatePoint | ( | const double | lx, |
| const double | ly, | ||
| const double | lz, | ||
| double & | gx, | ||
| double & | gy, | ||
| double & | gz | ||
| ) | const [inline] |
Rotate a 3D point (lx,ly,lz) -> (gx,gy,gz) as described by this quaternion.
Definition at line 146 of file CQuaternion.h.
| void mrpt::math::CQuaternion::rotationJacobian | ( | MATRIXLIKE & | J | ) | const [inline] |
Compute the Jacobian of the rotation composition operation
, that is the 4x4 matrix
.
The output matrix can be a dynamic or fixed size (4x4) matrix.
Definition at line 212 of file CQuaternion.h.
| void mrpt::math::CQuaternion::rotationMatrix | ( | MATRIXLIKE & | M | ) | const [inline] |
Calculate the 3x3 rotation matrix associated to this quaternion.
Definition at line 223 of file CQuaternion.h.
| void mrpt::math::CQuaternion::rotationMatrixNoResize | ( | MATRIXLIKE & | M | ) | const [inline] |
Fill out the top-left 3x3 block of the given matrix with the rotation matrix associated to this quaternion (does not resize the matrix, for that, see rotationMatrix)
Definition at line 231 of file CQuaternion.h.
Referenced by mrpt::math::CQuaternion< double >::rotationMatrix().
| void mrpt::math::CQuaternion::rpy | ( | T & | roll, |
| T & | pitch, | ||
| T & | yaw | ||
| ) | const [inline] |
Return the yaw, pitch & roll angles associated to quaternion.
Definition at line 260 of file CQuaternion.h.
| void mrpt::math::CQuaternion::rpy_and_jacobian | ( | T & | roll, |
| T & | pitch, | ||
| T & | yaw, | ||
| MATRIXLIKE * | out_dr_dq = NULL, |
||
| bool | resize_out_dr_dq_to3x4 = true |
||
| ) | const [inline] |
Return the yaw, pitch & roll angles associated to quaternion, and (optionally) the 3x4 Jacobian of the transformation.
Note that both the angles and the Jacobian have one set of normal equations, plus other special formulas for the degenerated cases of |pitch|=90 degrees.
Definition at line 271 of file CQuaternion.h.
Referenced by mrpt::math::CQuaternion< double >::rpy().
| T mrpt::math::CQuaternion::x | ( | ) | const [inline] |
Return x coordinate of the quaternion.
Definition at line 95 of file CQuaternion.h.
Referenced by mrpt::math::CQuaternion< double >::CQuaternion(), mrpt::math::CQuaternion< double >::fromRodriguesVector(), mrpt::math::CQuaternion< double >::crossProduct(), mrpt::math::CQuaternion< double >::rotatePoint(), mrpt::math::CQuaternion< double >::inverseRotatePoint(), mrpt::math::CQuaternion< double >::normSqr(), mrpt::math::CQuaternion< double >::normalizationJacobian(), mrpt::math::CQuaternion< double >::rotationJacobian(), mrpt::math::CQuaternion< double >::rotationMatrixNoResize(), mrpt::math::CQuaternion< double >::conj(), and mrpt::math::CQuaternion< double >::rpy_and_jacobian().
| void mrpt::math::CQuaternion::x | ( | const T | x | ) | [inline] |
Set x coordinate of the quaternion.
Definition at line 99 of file CQuaternion.h.
Referenced by mrpt::math::CQuaternion< double >::x().
| T mrpt::math::CQuaternion::y | ( | ) | const [inline] |
Return y coordinate of the quaternion.
Definition at line 96 of file CQuaternion.h.
Referenced by mrpt::math::CQuaternion< double >::CQuaternion(), mrpt::math::CQuaternion< double >::fromRodriguesVector(), mrpt::math::CQuaternion< double >::crossProduct(), mrpt::math::CQuaternion< double >::rotatePoint(), mrpt::math::CQuaternion< double >::inverseRotatePoint(), mrpt::math::CQuaternion< double >::normSqr(), mrpt::math::CQuaternion< double >::normalizationJacobian(), mrpt::math::CQuaternion< double >::rotationJacobian(), mrpt::math::CQuaternion< double >::rotationMatrixNoResize(), mrpt::math::CQuaternion< double >::conj(), and mrpt::math::CQuaternion< double >::rpy_and_jacobian().
| void mrpt::math::CQuaternion::y | ( | const T | y | ) | [inline] |
Set y coordinate of the quaternion.
Definition at line 100 of file CQuaternion.h.
Referenced by mrpt::math::CQuaternion< double >::y().
| T mrpt::math::CQuaternion::z | ( | ) | const [inline] |
Return z coordinate of the quaternion.
Definition at line 97 of file CQuaternion.h.
Referenced by mrpt::math::CQuaternion< double >::CQuaternion(), mrpt::math::CQuaternion< double >::fromRodriguesVector(), mrpt::math::CQuaternion< double >::crossProduct(), mrpt::math::CQuaternion< double >::rotatePoint(), mrpt::math::CQuaternion< double >::inverseRotatePoint(), mrpt::math::CQuaternion< double >::normSqr(), mrpt::math::CQuaternion< double >::normalizationJacobian(), mrpt::math::CQuaternion< double >::rotationJacobian(), mrpt::math::CQuaternion< double >::rotationMatrixNoResize(), mrpt::math::CQuaternion< double >::conj(), and mrpt::math::CQuaternion< double >::rpy_and_jacobian().
| void mrpt::math::CQuaternion::z | ( | const T | z | ) | [inline] |
Set z coordinate of the quaternion.
Definition at line 101 of file CQuaternion.h.
Referenced by mrpt::math::CQuaternion< double >::z().
| Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011 |