Rotation structure and transformations between different parameterizations. More...
#include <Rotation.h>
Public Types | |
enum | RotationType { QUAT, MAT, EUL, ROD } |
Rotation can be represented in four ways: quaternion (QUAT), matrix (MAT), euler angles (EUL) and exponential map (ROD). More... | |
Public Member Functions | |
void | GetEuler (CvMat *mat) const |
Returns the rotation in Euler angles. | |
void | GetMatrix (CvMat *mat) const |
Returns the rotation in matrix form. 3x3 and 4x4 matrices are allowed. | |
void | GetQuaternion (CvMat *mat) const |
Returns the rotation in quaternion form. | |
void | GetRodriques (CvMat *mat) const |
Returns the rotation in rotation vector form. | |
void | Mirror (bool x, bool y, bool z) |
Mirrors the rotation in selected directions. | |
Rotation & | operator+= (const Rotation &v) |
Rotation & | operator= (const Rotation &p) |
void | Reset () |
Resets the rotation into identity. | |
Rotation () | |
Rotation (const Rotation &r) | |
Rotation (CvMat *data, RotationType t) | |
Constructor. | |
void | SetEuler (const CvMat *mat) |
Sets the rotation from given Euler angles. | |
void | SetMatrix (const CvMat *mat) |
Sets the rotation from given rotation matrix. 3x3 and 4x4 matrices are allowed. | |
void | SetQuaternion (CvMat *mat) |
Sets the rotation from given quaternion. | |
void | SetQuaternion (const double *quat) |
Sets the rotation from given quaternion. | |
void | SetRodriques (const CvMat *mat) |
Sets the rotation from given rotation vector. | |
void | Transpose () |
Static Public Member Functions | |
static void | EulToQuat (const double *eul, double *quat) |
Converts a rotation described by Euler angles into quaternion form. | |
static void | Mat9ToQuat (const double *mat, double *quat) |
Converts a 3x3 rotation martix into quaternion form. | |
static void | Mat9ToRod (double *mat, double *rod) |
Converts 3x3 rotation matrix into Rodriques representation. | |
static void | MirrorMat (CvMat *mat, bool x, bool y, bool z) |
Simple function to mirror a rotation matrix in different directions. | |
static void | QuatInv (const double *q, double *qi) |
Inverts unit quaternion. | |
static void | QuatMul (const double *q1, const double *q2, double *q3) |
Quaternion multiplication. | |
static void | QuatNorm (double *q) |
Normalizes a quaternion. | |
static void | QuatToEul (const double *q, double *eul) |
Converts a rotation described by a quaternion into Euler angles. | |
static void | QuatToMat16 (const double *quat, double *mat) |
Converts a rotation described by a quaternion into 4x4 OpenGL-like transformation matrix. The translation part is not altered. | |
static void | QuatToMat9 (const double *quat, double *mat) |
Converts a rotation described by a quaternion into 3x3 rotation matrix. | |
static void | RodToMat9 (double *rod, double *mat) |
Converts 3x1 rotation vector into 3x3 rotation matrix using Rodriques' formula. | |
Public Attributes | |
double | quaternion [4] |
CvMat | quaternion_mat |
Rotation structure and transformations between different parameterizations.
Definition at line 43 of file Rotation.h.
Rotation can be represented in four ways: quaternion (QUAT), matrix (MAT), euler angles (EUL) and exponential map (ROD).
Definition at line 53 of file Rotation.h.
Definition at line 32 of file Rotation.cpp.
alvar::Rotation::Rotation | ( | const Rotation & | r | ) |
Definition at line 38 of file Rotation.cpp.
alvar::Rotation::Rotation | ( | CvMat * | data, |
RotationType | t | ||
) |
Constructor.
data | Rotation data stored in CvMat. With RotationType::MAT both 3x3 and 4x4 matrices are allowed. |
t | Rotation type that corresponds to data. |
Definition at line 43 of file Rotation.cpp.
void alvar::Rotation::EulToQuat | ( | const double * | eul, |
double * | quat | ||
) | [static] |
Converts a rotation described by Euler angles into quaternion form.
eul | Rotation in Euler angles. |
quat | Resulting quaternion. |
Definition at line 271 of file Rotation.cpp.
void alvar::Rotation::GetEuler | ( | CvMat * | mat | ) | const |
Returns the rotation in Euler angles.
mat | The rotation is stored here (3x1 CvMat). |
Definition at line 348 of file Rotation.cpp.
void alvar::Rotation::GetMatrix | ( | CvMat * | mat | ) | const |
Returns the rotation in matrix form. 3x3 and 4x4 matrices are allowed.
mat | The rotation is stored here. |
Reimplemented in alvar::Pose.
Definition at line 331 of file Rotation.cpp.
void alvar::Rotation::GetQuaternion | ( | CvMat * | mat | ) | const |
Returns the rotation in quaternion form.
mat | The rotation is stored here (4x1 CvMat). |
Definition at line 353 of file Rotation.cpp.
void alvar::Rotation::GetRodriques | ( | CvMat * | mat | ) | const |
Returns the rotation in rotation vector form.
mat | The rotation is stored here (3x1 CvMat). |
Definition at line 341 of file Rotation.cpp.
void alvar::Rotation::Mat9ToQuat | ( | const double * | mat, |
double * | quat | ||
) | [static] |
Converts a 3x3 rotation martix into quaternion form.
mat | 3x3 rotation matrix. |
quat | Resulting quaternion. |
Definition at line 257 of file Rotation.cpp.
void alvar::Rotation::Mat9ToRod | ( | double * | mat, |
double * | rod | ||
) | [static] |
Converts 3x3 rotation matrix into Rodriques representation.
mat | 3x3 rotation matrix. |
rod | Resulting 3x1 rotation vector. |
Definition at line 99 of file Rotation.cpp.
void alvar::Rotation::Mirror | ( | bool | x, |
bool | y, | ||
bool | z | ||
) |
Mirrors the rotation in selected directions.
x | |
y | |
z |
Reimplemented in alvar::Pose.
Definition at line 85 of file Rotation.cpp.
void alvar::Rotation::MirrorMat | ( | CvMat * | mat, |
bool | x, | ||
bool | y, | ||
bool | z | ||
) | [static] |
Simple function to mirror a rotation matrix in different directions.
mat | Matrix to be mirrored. |
x | |
y | |
z |
Definition at line 75 of file Rotation.cpp.
Definition at line 365 of file Rotation.cpp.
Definition at line 359 of file Rotation.cpp.
void alvar::Rotation::QuatInv | ( | const double * | q, |
double * | qi | ||
) | [static] |
Inverts unit quaternion.
q | Unit quaternion to be inverted. |
qi | Resulting quaternion. |
Definition at line 115 of file Rotation.cpp.
void alvar::Rotation::QuatMul | ( | const double * | q1, |
const double * | q2, | ||
double * | q3 | ||
) | [static] |
Quaternion multiplication.
q1 | |
q2 | |
q3 | Resulting quaternion. |
Definition at line 132 of file Rotation.cpp.
void alvar::Rotation::QuatNorm | ( | double * | q | ) | [static] |
Normalizes a quaternion.
q | Quaternion to be normalized. |
Definition at line 123 of file Rotation.cpp.
void alvar::Rotation::QuatToEul | ( | const double * | q, |
double * | eul | ||
) | [static] |
Converts a rotation described by a quaternion into Euler angles.
q | Rotation in quaternion form. |
eul | Resulting Euler angles. |
Definition at line 221 of file Rotation.cpp.
void alvar::Rotation::QuatToMat16 | ( | const double * | quat, |
double * | mat | ||
) | [static] |
Converts a rotation described by a quaternion into 4x4 OpenGL-like transformation matrix. The translation part is not altered.
quat | Rotation in quaternion form. |
mat | Resulting 4x4 transformation matrix. |
Definition at line 185 of file Rotation.cpp.
void alvar::Rotation::QuatToMat9 | ( | const double * | quat, |
double * | mat | ||
) | [static] |
Converts a rotation described by a quaternion into 3x3 rotation matrix.
quat | Rotation in quaternion form. |
mat | Corresponding 3x3 rotation matrix. |
Definition at line 152 of file Rotation.cpp.
void alvar::Rotation::Reset | ( | ) |
Resets the rotation into identity.
Reimplemented in alvar::Pose.
Definition at line 94 of file Rotation.cpp.
void alvar::Rotation::RodToMat9 | ( | double * | rod, |
double * | mat | ||
) | [static] |
Converts 3x1 rotation vector into 3x3 rotation matrix using Rodriques' formula.
rod | 3x1 rotation vector. |
Resulting | 3x3 rotation matrix. |
Definition at line 107 of file Rotation.cpp.
void alvar::Rotation::SetEuler | ( | const CvMat * | mat | ) |
Sets the rotation from given Euler angles.
mat | Input Euler angles (3x1 CvMat). |
Definition at line 309 of file Rotation.cpp.
void alvar::Rotation::SetMatrix | ( | const CvMat * | mat | ) |
Sets the rotation from given rotation matrix. 3x3 and 4x4 matrices are allowed.
mat | Input rotation matrix (3x3 or 4x4 CvMat). |
Reimplemented in alvar::Pose.
Definition at line 321 of file Rotation.cpp.
void alvar::Rotation::SetQuaternion | ( | CvMat * | mat | ) |
Sets the rotation from given quaternion.
mat | Input quaternion (4x1 CvMat). |
Definition at line 294 of file Rotation.cpp.
void alvar::Rotation::SetQuaternion | ( | const double * | quat | ) |
Sets the rotation from given quaternion.
mat | Input quaternion (4x1 double array). |
Definition at line 300 of file Rotation.cpp.
void alvar::Rotation::SetRodriques | ( | const CvMat * | mat | ) |
Sets the rotation from given rotation vector.
mat | Input rotation vector (3x1 CvMat). |
Definition at line 314 of file Rotation.cpp.
void alvar::Rotation::Transpose | ( | ) |
Reimplemented in alvar::Pose.
Definition at line 66 of file Rotation.cpp.
double alvar::Rotation::quaternion[4] |
Definition at line 48 of file Rotation.h.
Definition at line 47 of file Rotation.h.