[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

details Quaternion< ValueType > Class Template Reference VIGRA

#include <vigra/quaternion.hxx>

List of all members.

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
Quaternionoperator*= (Quaternion const &other)
Quaternionoperator*= (double scale)
Quaternion operator+ () const
Quaternionoperator+= (value_type const &w)
Quaternionoperator+= (Quaternion const &other)
Quaternion operator- () const
Quaternionoperator-= (value_type const &w)
Quaternionoperator-= (Quaternion const &other)
Quaternionoperator/= (Quaternion const &other)
Quaternionoperator/= (double scale)
Quaternionoperator= (Quaternion const &other)
Quaternionoperator= (ValueType w)
bool operator== (Quaternion const &other) const
value_typeoperator[] (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 Vectorv () const
Vectorv ()
ValueType w () const
ValueType & w ()

Static Public Member Functions

static Quaternion createRotation (double angle, const Vector &rotationAxis)

Detailed Description

template<class ValueType>
class vigra::Quaternion< ValueType >

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


Member Typedef Documentation

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

typedef NormTraits<ValueType>::NormType NormType

the quaternion's norm type


Constructor & Destructor Documentation

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.


Member Function Documentation

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 Quaternion createRotation ( double  angle,
const Vector rotationAxis 
) [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.

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.


The documentation for this class was generated from the following file:

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de)
Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany

html generated using doxygen and Python
vigra 1.9.0 (Tue Nov 6 2012)