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:
Definition at line 60 of file CQuaternion.h.
#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 ![]() ![]() | |
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< T >::Base [private] |
Reimplemented from mrpt::math::CArrayNumeric< T, 4 >.
Definition at line 62 of file CQuaternion.h.
mrpt::math::CQuaternion< T >::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 68 of file CQuaternion.h.
mrpt::math::CQuaternion< T >::CQuaternion | ( | ) | [inline] |
Default constructor: construct a (1, (0,0,0) ) quaternion representing no rotation.
Definition at line 71 of file CQuaternion.h.
mrpt::math::CQuaternion< T >::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 80 of file CQuaternion.h.
void mrpt::math::CQuaternion< T >::conj | ( | CQuaternion< T > & | q_out | ) | const [inline] |
Return the conjugate quaternion.
Definition at line 239 of file CQuaternion.h.
CQuaternion mrpt::math::CQuaternion< T >::conj | ( | ) | const [inline] |
Return the conjugate quaternion.
Definition at line 248 of file CQuaternion.h.
Referenced by mrpt::math::CQuaternion< double >::conj().
void mrpt::math::CQuaternion< T >::crossProduct | ( | const CQuaternion< T > & | q1, |
const CQuaternion< T > & | 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 134 of file CQuaternion.h.
void mrpt::math::CQuaternion< T >::fromRodriguesVector | ( | const ARRAYLIKE & | in | ) | [inline] |
Set this quaternion to the rotation described by a 3D Rodrigues rotation vector.
Definition at line 105 of file CQuaternion.h.
void mrpt::math::CQuaternion< T >::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 156 of file CQuaternion.h.
void mrpt::math::CQuaternion< T >::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 181 of file CQuaternion.h.
void mrpt::math::CQuaternion< T >::normalize | ( | ) | [inline] |
Normalize this quaternion, so its norm becomes the unitity.
Definition at line 170 of file CQuaternion.h.
Referenced by mrpt::math::CQuaternion< double >::crossProduct().
double mrpt::math::CQuaternion< T >::normSqr | ( | ) | const [inline] |
Return the squared norm of the quaternion.
Definition at line 166 of file CQuaternion.h.
Referenced by mrpt::math::CQuaternion< double >::CQuaternion(), mrpt::math::CQuaternion< double >::normalizationJacobian(), and mrpt::math::CQuaternion< double >::normalize().
CQuaternion mrpt::math::CQuaternion< T >::operator* | ( | const T & | factor | ) | [inline] |
Definition at line 340 of file CQuaternion.h.
void mrpt::math::CQuaternion< T >::r | ( | const T | r | ) | [inline] |
Set r coordinate of the quaternion.
Definition at line 97 of file CQuaternion.h.
Referenced by mrpt::math::CQuaternion< double >::r().
T mrpt::math::CQuaternion< T >::r | ( | ) | const [inline] |
Return r coordinate of the quaternion.
Definition at line 93 of file CQuaternion.h.
Referenced by mrpt::math::CQuaternion< double >::conj(), mrpt::math::CQuaternion< double >::CQuaternion(), mrpt::math::CQuaternion< double >::crossProduct(), mrpt::math::CQuaternion< double >::inverseRotatePoint(), mrpt::math::CQuaternion< double >::normalizationJacobian(), mrpt::math::CQuaternion< double >::normSqr(), mrpt::math::CQuaternion< double >::rotatePoint(), mrpt::math::CQuaternion< double >::rotationJacobian(), mrpt::math::CQuaternion< double >::rotationMatrixNoResize(), and mrpt::math::CQuaternion< double >::rpy_and_jacobian().
void mrpt::math::CQuaternion< T >::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 145 of file CQuaternion.h.
void mrpt::math::CQuaternion< T >::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 211 of file CQuaternion.h.
void mrpt::math::CQuaternion< T >::rotationMatrix | ( | MATRIXLIKE & | M | ) | const [inline] |
Calculate the 3x3 rotation matrix associated to this quaternion.
Definition at line 222 of file CQuaternion.h.
void mrpt::math::CQuaternion< T >::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 230 of file CQuaternion.h.
Referenced by mrpt::math::CQuaternion< double >::rotationMatrix().
void mrpt::math::CQuaternion< T >::rpy | ( | T & | roll, |
T & | pitch, | ||
T & | yaw | ||
) | const [inline] |
Return the yaw, pitch & roll angles associated to quaternion.
Definition at line 259 of file CQuaternion.h.
void mrpt::math::CQuaternion< T >::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 270 of file CQuaternion.h.
Referenced by mrpt::math::CQuaternion< double >::rpy().
T mrpt::math::CQuaternion< T >::x | ( | ) | const [inline] |
Return x coordinate of the quaternion.
Definition at line 94 of file CQuaternion.h.
Referenced by mrpt::math::CQuaternion< double >::conj(), mrpt::math::CQuaternion< double >::CQuaternion(), mrpt::math::CQuaternion< double >::crossProduct(), mrpt::math::CQuaternion< double >::fromRodriguesVector(), mrpt::math::CQuaternion< double >::inverseRotatePoint(), mrpt::math::CQuaternion< double >::normalizationJacobian(), mrpt::math::CQuaternion< double >::normSqr(), mrpt::math::CQuaternion< double >::rotatePoint(), mrpt::math::CQuaternion< double >::rotationJacobian(), mrpt::math::CQuaternion< double >::rotationMatrixNoResize(), and mrpt::math::CQuaternion< double >::rpy_and_jacobian().
void mrpt::math::CQuaternion< T >::x | ( | const T | x | ) | [inline] |
Set x coordinate of the quaternion.
Definition at line 98 of file CQuaternion.h.
Referenced by mrpt::math::CQuaternion< double >::x().
void mrpt::math::CQuaternion< T >::y | ( | const T | y | ) | [inline] |
Set y coordinate of the quaternion.
Definition at line 99 of file CQuaternion.h.
Referenced by mrpt::math::CQuaternion< double >::y().
T mrpt::math::CQuaternion< T >::y | ( | ) | const [inline] |
Return y coordinate of the quaternion.
Definition at line 95 of file CQuaternion.h.
Referenced by mrpt::math::CQuaternion< double >::conj(), mrpt::math::CQuaternion< double >::CQuaternion(), mrpt::math::CQuaternion< double >::crossProduct(), mrpt::math::CQuaternion< double >::fromRodriguesVector(), mrpt::math::CQuaternion< double >::inverseRotatePoint(), mrpt::math::CQuaternion< double >::normalizationJacobian(), mrpt::math::CQuaternion< double >::normSqr(), mrpt::math::CQuaternion< double >::rotatePoint(), mrpt::math::CQuaternion< double >::rotationJacobian(), mrpt::math::CQuaternion< double >::rotationMatrixNoResize(), and mrpt::math::CQuaternion< double >::rpy_and_jacobian().
void mrpt::math::CQuaternion< T >::z | ( | const T | z | ) | [inline] |
Set z coordinate of the quaternion.
Definition at line 100 of file CQuaternion.h.
Referenced by mrpt::math::CQuaternion< double >::z().
T mrpt::math::CQuaternion< T >::z | ( | ) | const [inline] |
Return z coordinate of the quaternion.
Definition at line 96 of file CQuaternion.h.
Referenced by mrpt::math::CQuaternion< double >::conj(), mrpt::math::CQuaternion< double >::CQuaternion(), mrpt::math::CQuaternion< double >::crossProduct(), mrpt::math::CQuaternion< double >::fromRodriguesVector(), mrpt::math::CQuaternion< double >::inverseRotatePoint(), mrpt::math::CQuaternion< double >::normalizationJacobian(), mrpt::math::CQuaternion< double >::normSqr(), mrpt::math::CQuaternion< double >::rotatePoint(), mrpt::math::CQuaternion< double >::rotationJacobian(), mrpt::math::CQuaternion< double >::rotationMatrixNoResize(), and mrpt::math::CQuaternion< double >::rpy_and_jacobian().
Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN:exported at Tue Jan 25 21:56:31 UTC 2011 |