PARP Research Group |
Universidad de Murcia ![]() |
QVQuaternion Class Reference
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Public Member Functions | |
| QVQuaternion () | |
| Identity constructor. | |
| QVQuaternion (const QVVector direction, const double phi) | |
| Axis rotation constructor. | |
| QVQuaternion (const QVVector &source) | |
| Construct from a vector. | |
| QVQuaternion (const QVVector direction, float phi) | |
| Axis rotation constructor. | |
| QVQuaternion (const double i, const double j, const double k, const double r) | |
| Direct coordinates constructor. | |
| QVQuaternion (const double xAngle, const double yAngle, const double zAngle) | |
| Constructor from 3 euler angles. | |
| QVQuaternion (const QVMatrix &matrix) | |
| Rotation matrix constructor. | |
| QVQuaternion | operator* (const QVQuaternion &quaternion) const |
| Quaternion product. | |
| QVQuaternion (const QVQuaternion &quaternion) | |
| Copy constructor. | |
| QVQuaternion | quaternionProduct (const QVQuaternion &quaternion) const |
| Combination operation for quaternions. | |
| void | toEulerAngles (double &xAngle, double &yAngle, double &zAngle) const |
| Gets the Euler angles corresponding to the Quaternion. | |
| QVMatrix | toRotationMatrix () const |
| Gets the rotation matrix corresponding to the Quaternion. | |
| QVQuaternion | conjugate () const |
| Gets the conjugate of the quaternion. | |
| QVQuaternion | inverse () const |
| Gets the inverse of the quaternion. | |
| double | norm2 () const |
| Gets the norm2 of the quaternion. | |
| QV3DPointF | rotate (const QV3DPointF &v) const |
| Direct vector rotation. | |
| double & | real () |
| Returns the coordinate for the real component of the cuaternion. | |
| double & | i () |
| Returns the coordinate i of the cuaternion. | |
| double & | j () |
| Returns the coordinate j of the cuaternion. | |
| double & | k () |
| Returns the coordinate k of the cuaternion. | |
| double | real () const |
| Sets the coordinate for the real component of the cuaternion. | |
| double | i () const |
| Sets the coordinate i of the cuaternion. | |
| double | j () const |
| Sets the coordinate j of the cuaternion. | |
| double | k () const |
| Sets the coordinate k of the cuaternion. | |
| QVQuaternion | normalizeQuaternion () const |
| Retuns a normalized quaternion. | |
Static Public Member Functions | |
| static QVQuaternion | trackball (float p1x, float p1y, float p2x, float p2y) |
| Gets the quaternion corresponding to a trackball rotation. | |
Implementation of quaternions.
Quaternions are an extension of the imaginary numbers. They are mostly used to represent rotations in the euclidean 3D space.
Definition at line 44 of file qvquaternion.h.
| QVQuaternion::QVQuaternion | ( | ) |
Identity constructor.
Creates quaternion to identity rotation.
Definition at line 32 of file qvquaternion.cpp.
Referenced by QVQuaternion(), and trackball().
| QVQuaternion::QVQuaternion | ( | const QVVector | direction, | |
| const double | phi | |||
| ) |
Axis rotation constructor.
Creates a quaternion object which rotates around a direction a given angle.
| direction | quaternion will rotate around this direction. | |
| phi | quaternion will rotate this angle, given in radians. |
Definition at line 39 of file qvquaternion.cpp.
| QVQuaternion::QVQuaternion | ( | const QVVector & | source | ) | [inline] |
Construct from a vector.
Creates a quaternion from a vector of size 4.
| source | The vector of size 4. |
Definition at line 68 of file qvquaternion.h.
| QVQuaternion::QVQuaternion | ( | const QVVector | direction, | |
| float | phi | |||
| ) |
Axis rotation constructor.
Creates a quaternion object which rotates around a direction a given angle.
| direction | quaternion will rotate around this direction. | |
| phi | quaternion will rotate this angle, given in radians. |
| QVQuaternion::QVQuaternion | ( | const double | i, | |
| const double | j, | |||
| const double | k, | |||
| const double | r | |||
| ) |
Direct coordinates constructor.
Creates a quaternion from its coordinate coefficients.
| i | Coefficient for the i coordinate | |
| j | Coefficient for the j coordinate | |
| k | Coefficient for the k coordinate | |
| r | Coefficient for the real coordinate |
Definition at line 147 of file qvquaternion.cpp.
| QVQuaternion::QVQuaternion | ( | const double | xAngle, | |
| const double | yAngle, | |||
| const double | zAngle | |||
| ) |
Constructor from 3 euler angles.
Creates a quaternion given the three euler angles of the rotation it represents.
| xAngle | Euler angle for the x axis. | |
| yAngle | Euler angle for the y axis. | |
| zAngle | Euler angle for the z axis. |
Definition at line 158 of file qvquaternion.cpp.
| QVQuaternion::QVQuaternion | ( | const QVMatrix & | matrix | ) |
Rotation matrix constructor.
Creates a quaternion from a rotation matrix.
| matrix | rotation matrix to create the quaternion from |
Definition at line 52 of file qvquaternion.cpp.
| QVQuaternion::QVQuaternion | ( | const QVQuaternion & | quaternion | ) | [inline] |
Copy constructor.
Creates a quaternion copying its coordinates from a given one.
| quaternion | quaternion to copy coordinates |
Definition at line 114 of file qvquaternion.h.
| QVQuaternion QVQuaternion::operator* | ( | const QVQuaternion & | quaternion | ) | const [inline] |
Quaternion product.
| quaternion | operand for the product |
Definition at line 107 of file qvquaternion.h.
| QVQuaternion QVQuaternion::trackball | ( | float | p1x, | |
| float | p1y, | |||
| float | p2x, | |||
| float | p2y | |||
| ) | [static] |
Gets the quaternion corresponding to a trackball rotation.
Creates a quaternion which rotates given two points at a plane, mapped to a sphere.
| p1x | first coordinate for first point. | |
| p1y | second coordinate for first point. | |
| p2x | first coordinate for second point. | |
| p2y | second coordinate for second point. |
Definition at line 186 of file qvquaternion.cpp.
| QVQuaternion QVQuaternion::quaternionProduct | ( | const QVQuaternion & | quaternion | ) | const |
Combination operation for quaternions.
Creates a quaternion corresponding to combination of rotations corresponding to actual quaternion and the one received by parameter
| quaternion | operand in the combining operation. |
Definition at line 218 of file qvquaternion.cpp.
Referenced by operator*().
| void QVQuaternion::toEulerAngles | ( | double & | xAngle, | |
| double & | yAngle, | |||
| double & | zAngle | |||
| ) | const |
Gets the Euler angles corresponding to the Quaternion.
| xAxis | Return variable that will contain the rotation in the x angle for the quaternion. | |
| yAxis | Return variable that will contain the rotation in the y angle for the quaternion. | |
| zAxis | Return variable that will contain the rotation in the z angle for the quaternion. |
Definition at line 234 of file qvquaternion.cpp.
| QVMatrix QVQuaternion::toRotationMatrix | ( | ) | const |
Gets the rotation matrix corresponding to the Quaternion.
Definition at line 253 of file qvquaternion.cpp.
Referenced by QVMatrix::QVMatrix(), QVCameraPose::toProjectionMatrix(), and QVEuclideanMapping3::toRotationTranslationMatrix().
| QVQuaternion QVQuaternion::conjugate | ( | ) | const |
Gets the conjugate of the quaternion.
Definition at line 280 of file qvquaternion.cpp.
| QVQuaternion QVQuaternion::inverse | ( | ) | const |
Gets the inverse of the quaternion.
Definition at line 290 of file qvquaternion.cpp.
Referenced by QVCameraPose::compose(), QVEuclideanMapping3::inverse(), and QVCameraPose::inverse().
| double QVQuaternion::norm2 | ( | ) | const |
Gets the norm2 of the quaternion.
Reimplemented from QVVector.
Definition at line 302 of file qvquaternion.cpp.
Referenced by QVCameraPose::compose(), conjugate(), inverse(), QVCameraPose::inverse(), QVCameraPose::operator QVEuclideanMapping3(), QVCameraPose::operator QVVector(), QVCameraPose::operator!=(), QVCameraPose::operator==(), QVCameraPose::project(), quaternionProduct(), QVCameraPose::QVCameraPose(), QVQuaternion(), rotate(), QVCameraPose::toCameraReferenceCoordinates(), toEulerAngles(), QVCameraPose::toProjectionMatrix(), toRotationMatrix(), and trackball().
| QV3DPointF QVQuaternion::rotate | ( | const QV3DPointF & | v | ) | const |
Direct vector rotation.
Rotates a 3D Applies the quaternion rotation to a 3D point.
Definition at line 307 of file qvquaternion.cpp.
Referenced by QVEuclideanMapping3::apply(), QVEuclideanMapping3::compose(), QVCameraPose::compose(), QVEuclideanMapping3::inverse(), QVCameraPose::inverse(), QVCameraPose::operator QVEuclideanMapping3(), QVCameraPose::project(), QVCameraPose::toCameraReferenceCoordinates(), and QVCameraPose::toProjectionMatrix().
| double& QVQuaternion::real | ( | ) | [inline] |
Returns the coordinate for the real component of the cuaternion.
Definition at line 172 of file qvquaternion.h.
Referenced by QVQuaternion().
| double& QVQuaternion::i | ( | ) | [inline] |
Returns the coordinate i of the cuaternion.
Definition at line 175 of file qvquaternion.h.
Referenced by normalizeQuaternion(), and QVQuaternion().
| double& QVQuaternion::j | ( | ) | [inline] |
Returns the coordinate j of the cuaternion.
Definition at line 178 of file qvquaternion.h.
Referenced by QVQuaternion().
| double& QVQuaternion::k | ( | ) | [inline] |
Returns the coordinate k of the cuaternion.
Definition at line 181 of file qvquaternion.h.
Referenced by QVQuaternion().
| double QVQuaternion::real | ( | ) | const [inline] |
Sets the coordinate for the real component of the cuaternion.
Definition at line 184 of file qvquaternion.h.
| double QVQuaternion::i | ( | ) | const [inline] |
Sets the coordinate i of the cuaternion.
Definition at line 187 of file qvquaternion.h.
| double QVQuaternion::j | ( | ) | const [inline] |
Sets the coordinate j of the cuaternion.
Definition at line 190 of file qvquaternion.h.
| double QVQuaternion::k | ( | ) | const [inline] |
Sets the coordinate k of the cuaternion.
Definition at line 193 of file qvquaternion.h.
| QVQuaternion QVQuaternion::normalizeQuaternion | ( | ) | const |
Retuns a normalized quaternion.
Definition at line 207 of file qvquaternion.cpp.