[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]
|   | Quaternion< ValueType > Class Template Reference |  | 
#include <vigra/quaternion.hxx>
| Public Types | |
| typedef ValueType const & | const_reference | 
| typedef NormTraits< ValueType > ::NormType | NormType | 
| typedef ValueType & | reference | 
| typedef NormTraits< ValueType > ::SquaredNormType | SquaredNormType | 
| typedef ValueType | value_type | 
| Public Member Functions | |
| template<class MatrixType > | |
| void | fillRotationMatrix (MatrixType &matrix) const | 
| NormType | magnitude () const | 
| bool | operator!= (Quaternion const &other) const | 
| Quaternion & | operator*= (Quaternion const &other) | 
| Quaternion & | operator*= (double scale) | 
| Quaternion | operator+ () const | 
| Quaternion & | operator+= (value_type const &w) | 
| Quaternion & | operator+= (Quaternion const &other) | 
| Quaternion | operator- () const | 
| Quaternion & | operator-= (value_type const &w) | 
| Quaternion & | operator-= (Quaternion const &other) | 
| Quaternion & | operator/= (Quaternion const &other) | 
| Quaternion & | operator/= (double scale) | 
| Quaternion & | operator= (Quaternion const &other) | 
| Quaternion & | operator= (ValueType w) | 
| bool | operator== (Quaternion const &other) const | 
| value_type & | operator[] (int index) | 
| value_type | operator[] (int index) const | 
| Quaternion (ValueType w=0, ValueType x=0, ValueType y=0, ValueType z=0) | |
| Quaternion (ValueType w, const Vector &v) | |
| Quaternion (const Quaternion &q) | |
| void | setV (const Vector &v) | 
| void | setV (ValueType x, ValueType y, ValueType z) | 
| void | setW (ValueType w) | 
| SquaredNormType | squaredMagnitude () const | 
| const Vector & | v () const | 
| Vector & | v () | 
| ValueType | w () const | 
| ValueType & | w () | 
| Static Public Member Functions | |
| static Quaternion | createRotation (double angle, const Vector &rotationAxis) | 
Quaternion class.
Quaternions are mainly used as a compact representation for 3D rotations because they are much less prone to round-off errors than rotation matrices, especially when many rotations are concatenated. In addition, the angle/axis interpretation of normalized quaternions is very intuitive. Read the Wikipedia entry on quaternions for more information on the mathematics.
See also: Quaternion Operations
| typedef ValueType value_type | 
the quaternion's valuetype
| typedef ValueType& reference | 
reference (return of operator[]).
| typedef ValueType const& const_reference | 
const reference (return of operator[] const).
| typedef NormTraits<ValueType>::SquaredNormType SquaredNormType | 
the quaternion's squared norm type
| Quaternion | ( | ValueType | w = 0, | 
| ValueType | x = 0, | ||
| ValueType | y = 0, | ||
| ValueType | z = 0 | ||
| ) | 
Construct a quaternion with explicit values for the real and imaginary parts.
| Quaternion | ( | ValueType | w, | 
| const Vector & | v | ||
| ) | 
Construct a quaternion with real value and imaginary vector.
Equivalent to Quaternion(w, v[0], v[1], v[2]). 
| Quaternion | ( | const Quaternion< ValueType > & | q | ) | 
Copy constructor.
| Quaternion& operator= | ( | Quaternion< ValueType > const & | other | ) | 
Copy assignment.
| Quaternion& operator= | ( | ValueType | w | ) | 
Assign w to the real part and set the imaginary part to zero.
| 
 | static | 
Creates a Quaternion which represents the operation of rotating around the given axis by the given angle.
The angle should be in the range -pi..3*pi for sensible results.
| ValueType w | ( | ) | const | 
Read real part.
| ValueType& w | ( | ) | 
Access real part.
| void setW | ( | ValueType | w | ) | 
Set real part.
| const Vector& v | ( | ) | const | 
Read imaginary part.
| Vector& v | ( | ) | 
Access imaginary part.
| void setV | ( | const Vector & | v | ) | 
Set imaginary part.
| void setV | ( | ValueType | x, | 
| ValueType | y, | ||
| ValueType | z | ||
| ) | 
Set imaginary part.
| value_type& operator[] | ( | int | index | ) | 
Access entry at index (0 <=> w(), 1 <=> v[0] etc.).
| value_type operator[] | ( | int | index | ) | const | 
Read entry at index (0 <=> w(), 1 <=> v[0] etc.).
| NormType magnitude | ( | ) | const | 
Magnitude.
| SquaredNormType squaredMagnitude | ( | ) | const | 
Squared magnitude.
| Quaternion& operator+= | ( | value_type const & | w | ) | 
Add w to the real part.
If the quaternion represents a rotation, the rotation angle is increased by w.
| Quaternion& operator+= | ( | Quaternion< ValueType > const & | other | ) | 
Add assigment.
| Quaternion& operator-= | ( | value_type const & | w | ) | 
Subtract w from the real part.
If the quaternion represents a rotation, the rotation angle is decreased by w.
| Quaternion& operator-= | ( | Quaternion< ValueType > const & | other | ) | 
Subtract assigment.
| Quaternion operator+ | ( | ) | const | 
Addition.
| Quaternion operator- | ( | ) | const | 
Subtraction.
| Quaternion& operator*= | ( | Quaternion< ValueType > const & | other | ) | 
Multiply assignment.
If the quaternions represent rotations, the rotations of this and other are concatenated. 
| Quaternion& operator*= | ( | double | scale | ) | 
Multiply all entries with the scalar scale.
| Quaternion& operator/= | ( | Quaternion< ValueType > const & | other | ) | 
Divide assignment.
| Quaternion& operator/= | ( | double | scale | ) | 
Devide all entries by the scalar scale.
| bool operator== | ( | Quaternion< ValueType > const & | other | ) | const | 
Equal.
| bool operator!= | ( | Quaternion< ValueType > const & | other | ) | const | 
Not equal.
| void fillRotationMatrix | ( | MatrixType & | matrix | ) | const | 
Fill the first 3x3 elements of the given matrix with a rotation matrix performing the same 3D rotation as this quaternion. If matrix is in column-major format, it should be pre-multiplied with the vectors to be rotated, i.e. matrix[0][0-3] will be the rotated X axis.
| 
© Ullrich Köthe     (ullrich.koethe@iwr.uni-heidelberg.de)  | 
html generated using doxygen and Python
 |