Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

vnl_quaternion< T > Class Template Reference

#include <vnl_quaternion.h>

Inheritance diagram for vnl_quaternion:

Inheritance graph
[legend]
Collaboration diagram for vnl_quaternion< T >:

Collaboration graph
[legend]
List of all members.

Public Methods

 vnl_quaternion ()
 vnl_quaternion (T x, T y, T z, T r)
 vnl_quaternion (const vnl_vector< T > &axis, T angle)
 vnl_quaternion (const vnl_matrix< T > &transform)
 vnl_quaternion (const vnl_vector< T > &vec)
 vnl_quaternion (const vnl_quaternion< T > &from)
 ~vnl_quaternion ()
vnl_quaternion & operator= (const vnl_quaternion< T > &rhs)
T & x ()
T & y ()
T & z ()
T & r ()
x () const
y () const
z () const
r () const
real () const
vnl_vector< T > imaginary () const
vnl_vector< T > axis () const
angle () const
vnl_matrix_fixed< T, 3, 3 > rotation_matrix () const
vnl_matrix_fixed< T, 4, 4 > rotation_matrix_4 () const
vnl_quaternion< T > conjugate () const
vnl_quaternion< T > inverse () const
vnl_quaternion< T > operator * (const vnl_quaternion< T > &) const
vnl_vector< T > rotate (const vnl_vector< T > &v) const

Detailed Description

template<class T>
class vnl_quaternion< T >

4-element vector that represents rotation in 3D. Quaternion is a 4-element vector with 1 real and 3 imaginary components:
      q = r + (i*x + j*y + k*z)
      r = cos(theta/2)
      (x, y, z) = sin(theta/2) (kx, ky, kz) 
   
where theta and k are respectively the angle and axis of rotation. 3D vectors can be thought of as imaginary quaternions, and so a quaternion is represented as a Vector<T> with the imaginary part before the real part for 1-1 alignment.

Unit quaternion provides a more efficient representation for rotation, than the usual orthonormal matrix that has nine parameters and six orthonormal constraints. The unit quaternion has only one unit magnitude constraint. Composing rotations with quaternions results in fewer multiplications and less error. To insure valid rotation result, the nearest unit quaternion is computed, and this is much easier than finding the nearest orthonormal matrix. Transforming vectors with a quaternion requires more operations compared to multiplication with the equivalent orthonormal matrix.

See also Vector<Type> and Matrix<Type> for basic operations on vectors and matrices.

Transform for coordinate transformations.

Envelope for envelope-letter scheme that avoids deep copy on return by value in arithmetic expressions like: q1 * q2 * q3 *...

Definition at line 59 of file vnl_quaternion.h.


Constructor & Destructor Documentation

template<class T>
vnl_quaternion< T >::vnl_quaternion   [inline]
 

Constructor for null quaternion.

Definition at line 65 of file vnl_quaternion.h.

template<class T>
vnl_quaternion< T >::vnl_quaternion   x,
  y,
  z,
  r
 

Construct quaternion from components x,y,z,r.

template<class T>
vnl_quaternion< T >::vnl_quaternion const vnl_vector< T > &    axis,
  angle
 

Construct quaternion from axis and angle of rotation.

template<class T>
vnl_quaternion< T >::vnl_quaternion const vnl_matrix< T > &    transform [explicit]
 

Construct quaternion from from 3-4 square row-major.

template<class T>
vnl_quaternion< T >::vnl_quaternion const vnl_vector< T > &    vec
 

Construct quaternion from from from 3-4D vector.

template<class T>
vnl_quaternion< T >::vnl_quaternion const vnl_quaternion< T > &    from [inline]
 

Copy constructor.

Definition at line 151 of file vnl_quaternion.h.

References vnl_vector< T >::operator()().

template<class T>
vnl_quaternion< T >::~vnl_quaternion   [inline]
 

Free internal array.

Definition at line 161 of file vnl_quaternion.h.


Member Function Documentation

template<class T>
T vnl_quaternion< T >::angle   const
 

Angle of rotation.

Referenced by vnl_quaternion< TScalarType >::vnl_quaternion().

template<class T>
vnl_vector<T> vnl_quaternion< T >::axis   const
 

Axis of rotation.

Referenced by vnl_quaternion< TScalarType >::vnl_quaternion().

template<class T>
vnl_quaternion<T> vnl_quaternion< T >::conjugate   const
 

Same real, opposite img part.

template<class T>
vnl_vector< T > vnl_quaternion< T >::imaginary   const [inline]
 

Imaginary vector part.

Definition at line 235 of file vnl_quaternion.h.

template<class T>
vnl_quaternion<T> vnl_quaternion< T >::inverse   const
 

Inverse for nonzero quat.

template<class T>
vnl_quaternion<T> vnl_quaternion< T >::operator * const vnl_quaternion< T > &    const
 

template<class T>
vnl_quaternion< T > & vnl_quaternion< T >::operator= const vnl_quaternion< T > &    rhs [inline]
 

q1 = q2.

Definition at line 251 of file vnl_quaternion.h.

template<class T>
T vnl_quaternion< T >::r   const [inline]
 

r. Accessors for the imaginary and real components of the quaternion. Use these accessors to both get and set the components.

Definition at line 227 of file vnl_quaternion.h.

template<class T>
T & vnl_quaternion< T >::r   [inline]
 

Real component.

Definition at line 195 of file vnl_quaternion.h.

References vnl_vector< T >::operator()().

Referenced by vnl_quaternion< TScalarType >::vnl_quaternion().

template<class T>
T vnl_quaternion< T >::real   const [inline]
 

Copies and returns the real part.

Definition at line 242 of file vnl_quaternion.h.

template<class T>
vnl_vector<T> vnl_quaternion< T >::rotate const vnl_vector< T > &    v const
 

Rotate 3D v.

template<class T>
vnl_matrix_fixed<T,3,3> vnl_quaternion< T >::rotation_matrix   const
 

3x3 rotation matrix.

template<class T>
vnl_matrix_fixed<T,4,4> vnl_quaternion< T >::rotation_matrix_4   const
 

4x4 rotation matrix.

template<class T>
T vnl_quaternion< T >::x   const [inline]
 

x.

Reimplemented from vnl_vector< T >.

Definition at line 203 of file vnl_quaternion.h.

References vnl_vector< T >::extract().

template<class T>
T & vnl_quaternion< T >::x   [inline]
 

x.

Definition at line 168 of file vnl_quaternion.h.

References vnl_vector< T >::operator()().

Referenced by vnl_quaternion< TScalarType >::vnl_quaternion().

template<class T>
T vnl_quaternion< T >::y   const [inline]
 

y.

Reimplemented from vnl_vector< T >.

Definition at line 210 of file vnl_quaternion.h.

References vnl_vector< T >::get().

template<class T>
T & vnl_quaternion< T >::y   [inline]
 

y.

Definition at line 176 of file vnl_quaternion.h.

References vnl_vector< T >::operator()().

Referenced by vnl_quaternion< TScalarType >::vnl_quaternion().

template<class T>
T vnl_quaternion< T >::z   const [inline]
 

z.

Reimplemented from vnl_vector< T >.

Definition at line 217 of file vnl_quaternion.h.

template<class T>
T & vnl_quaternion< T >::z   [inline]
 

Imaginary components, parallel to axis of rotation.

Definition at line 184 of file vnl_quaternion.h.

Referenced by vnl_quaternion< TScalarType >::vnl_quaternion().


The documentation for this class was generated from the following file:
Generated at Wed Mar 12 01:13:38 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000