|
| Quaternion () |
|
| Quaternion (value_type x, value_type y, value_type z, value_type w) |
|
| Quaternion (ossim_float64 angle, const ossimDpt3d &axis) |
|
| Quaternion (ossim_float64 angle, const ossimColumnVector3d &axis) |
|
Quaternion & | operator= (const Quaternion &v) |
|
bool | operator== (const Quaternion &v) const |
|
bool | operator!= (const Quaternion &v) const |
|
bool | operator< (const Quaternion &v) const |
|
void | set (value_type x, value_type y, value_type z, value_type w) |
|
void | set (const ossimMatrix4x4 &matrix) |
| Good introductions to Quaternions at: http://www.gamasutra.com/features/programming/19980703/quaternions_01.htm http://mathworld.wolfram.com/Quaternion.html. More...
|
|
void | get (ossimMatrix4x4 &matrix) const |
|
value_type & | operator[] (int i) |
|
value_type | operator[] (int i) const |
|
value_type & | x () |
|
value_type & | y () |
|
value_type & | z () |
|
value_type & | w () |
|
value_type | x () const |
|
value_type | y () const |
|
value_type | z () const |
|
value_type | w () const |
|
bool | zeroRotation () const |
| return true if the Quaternion represents a zero rotation, and therefore can be ignored in computations. More...
|
|
const Quaternion | operator* (value_type rhs) const |
| Multiply by scalar. More...
|
|
Quaternion & | operator*= (value_type rhs) |
| Unary multiply by scalar. More...
|
|
const Quaternion | operator* (const Quaternion &rhs) const |
| Binary multiply. More...
|
|
Quaternion & | operator*= (const Quaternion &rhs) |
| Unary multiply. More...
|
|
Quaternion | operator/ (value_type rhs) const |
| Divide by scalar. More...
|
|
Quaternion & | operator/= (value_type rhs) |
| Unary divide by scalar. More...
|
|
const Quaternion | operator/ (const Quaternion &denom) const |
| Binary divide. More...
|
|
Quaternion & | operator/= (const Quaternion &denom) |
| Unary divide. More...
|
|
const Quaternion | operator+ (const Quaternion &rhs) const |
| Binary addition. More...
|
|
Quaternion & | operator+= (const Quaternion &rhs) |
| Unary addition. More...
|
|
const Quaternion | operator- (const Quaternion &rhs) const |
| Binary subtraction. More...
|
|
Quaternion & | operator-= (const Quaternion &rhs) |
| Unary subtraction. More...
|
|
const Quaternion | operator- () const |
| Negation operator - returns the negative of the quaternion. More...
|
|
value_type | length () const |
| Length of the quaternion = sqrt( vec . vec ) More...
|
|
value_type | length2 () const |
| Length of the quaternion = vec . vec. More...
|
|
Quaternion | conj () const |
| Conjugate. More...
|
|
const Quaternion | inverse () const |
| Multiplicative inverse method: q^(-1) = q^*/(q.q^*) More...
|
|
void | makeRotate (value_type angle, value_type x, value_type y, value_type z) |
| Set the elements of the Quat to represent a rotation of angle (radians) around the axis (x,y,z) More...
|
|
void | makeRotate (value_type angle, const ossimColumnVector3d &vec) |
|
void | makeRotate (value_type angle, const ossimDpt3d &vec) |
|
void | makeRotate (value_type angle1, const ossimColumnVector3d &axis1, value_type angle2, const ossimColumnVector3d &axis2, value_type angle3, const ossimColumnVector3d &axis3) |
|
void | makeRotate (value_type angle1, const ossimDpt3d &axis1, value_type angle2, const ossimDpt3d &axis2, value_type angle3, const ossimDpt3d &axis3) |
|
void | makeRotate (const ossimColumnVector3d &vec1, const ossimColumnVector3d &vec2) |
| Make a rotation Quaternion which will rotate vec1 to vec2. More...
|
|
void | makeRotate (const ossimDpt3d &vec1, const ossimDpt3d &vec2) |
| Make a rotation Quaternion which will rotate vec1 to vec2. More...
|
|
void | getRotate (value_type &angle, value_type &x, value_type &y, value_type &z) const |
| Return the angle and vector components represented by the quaternion. More...
|
|
void | getRotate (value_type &angle, ossimDpt3d &vec) const |
| Return the angle and vector components represented by the quaternion. More...
|
|
void | slerp (value_type t, const Quaternion &from, const Quaternion &to) |
| Spherical Linear Interpolation. More...
|
|
ossimDpt3d | operator* (const ossimDpt3d &v) const |
| Rotate a vector by this quaternion. More...
|
|
A quaternion class.
It can be used to represent an orientation in 3D space.
Definition at line 13 of file ossimQuaternion.h.
Make a rotation Quaternion which will rotate vec1 to vec2.
Make a rotation Quat which will rotate vec1 to vec2.
Generally take a dot product to get the angle between these and then use a cross product to get the rotation axis Watch out for the two special cases of when the vectors are co-incident or opposite in direction.
This routine uses only fast geometric transforms, without costly acos/sin computations. It's exact, fast, and with less degenerate cases than the acos/sin method.
For an explanation of the math used, you may see for example: http://logiciels.cnes.fr/MARMOTTES/marmottes-mathematique.pdf
- Note
- This is the rotation with shortest angle, which is the one equivalent to the acos/sin transform method. Other rotations exists, for example to additionally keep a local horizontal attitude.
- Author
- Nicolas Brodu
Definition at line 85 of file ossimQuaternion.cpp.
References ossimDpt3d::length2(), ossimDpt3d::x, ossimDpt3d::y, and ossimDpt3d::z.
101 if ((fromLen2 < 1.0-1e-7) || (fromLen2 > 1.0+1e-7))
103 fromLen = sqrt(fromLen2);
104 sourceVector /= fromLen;
109 if ((toLen2 < 1.0-1e-7) || (toLen2 > 1.0+1e-7))
113 if ((toLen2 > fromLen2-1e-7) && (toLen2 < fromLen2+1e-7))
117 else toLen = sqrt(toLen2);
118 targetVector /= toLen;
123 double dotProdPlus1 = 1.0 + sourceVector * targetVector;
126 if (dotProdPlus1 < 1e-7) {
132 if (fabs(sourceVector.
x) < 0.6) {
133 const double norm = sqrt(1.0 - sourceVector.
x * sourceVector.
x);
138 }
else if (fabs(sourceVector.
y) < 0.6) {
139 const double norm = sqrt(1.0 - sourceVector.
y * sourceVector.
y);
145 const double norm = sqrt(1.0 - sourceVector.
z * sourceVector.
z);
156 const double s = sqrt(0.5 * dotProdPlus1);
157 const ossimDpt3d tmp = sourceVector ^ targetVector / (2.0*s);