![]() |
University of Murcia ![]() |
QVQuaternion Class ReferenceImplementation of quaternions.
More...
|
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 |
Combine 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. | |
QVVector | rotate (const QVVector &v) const |
Direct vector rotation. | |
Static Public Member Functions | |
static QVQuaternion | trackball (float p1x, float p1y, float p2x, float p2y) |
Gets quaternion corresponding to a trackball rotation. |
Definition at line 43 of file qvquaternion.h.
QVQuaternion::QVQuaternion | ( | ) |
Identity constructor.
Creates quaternion to identity rotation.
Definition at line 32 of file qvquaternion.cpp.
Referenced by conjugate(), quaternionProduct(), 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 38 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 67 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 121 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 129 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 48 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 113 of file qvquaternion.h.
QVQuaternion QVQuaternion::operator* | ( | const QVQuaternion & | quaternion | ) | const [inline] |
Quaternion product.
quaternion | operand for the product |
Definition at line 106 of file qvquaternion.h.
QVQuaternion QVQuaternion::trackball | ( | float | p1x, | |
float | p1y, | |||
float | p2x, | |||
float | p2y | |||
) | [static] |
Gets 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 154 of file qvquaternion.cpp.
QVQuaternion QVQuaternion::quaternionProduct | ( | const QVQuaternion & | quaternion | ) | const |
Combine 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 186 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 197 of file qvquaternion.cpp.
QVMatrix QVQuaternion::toRotationMatrix | ( | ) | const |
Gets the rotation matrix corresponding to the Quaternion.
Definition at line 213 of file qvquaternion.cpp.
Referenced by QVEuclideanMapping3::toRotationTranslationMatrix().
QVQuaternion QVQuaternion::conjugate | ( | ) | const |
Gets the conjugate of the quaternion.
Definition at line 237 of file qvquaternion.cpp.
Referenced by inverse().
QVQuaternion QVQuaternion::inverse | ( | ) | const |
Gets the inverse of the quaternion.
Definition at line 242 of file qvquaternion.cpp.
double QVQuaternion::norm2 | ( | ) | const |
Gets the norm2 of the quaternion.
Reimplemented from QVVector.
Definition at line 248 of file qvquaternion.cpp.
Referenced by QVMatrix::QVMatrix(), rotate(), toRotationMatrix(), and trackball().
Direct vector rotation.
Applies the quaternion rotation to a vector.
v | Vector to rotate |
Definition at line 253 of file qvquaternion.cpp.
Referenced by QVEuclideanMapping3::apply().