FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

Quaternion class used to perform rotations in 3D space. More...

#include <OpenFOAM/quaternion.H>


Detailed Description

Quaternion class used to perform rotations in 3D space.

Source files

Definition at line 61 of file quaternion.H.

Collaboration diagram for quaternion:

List of all members.

Public Member Functions

 quaternion ()
 Construct null.
 quaternion (const scalar w, const vector &v)
 Construct given scalar and vector parts.
 quaternion (const vector &d, const scalar theta)
 Construct a rotation quaternion given the direction d.
 quaternion (const scalar w)
 Construct given scalar part, the vector part = vector::zero.
 quaternion (const vector &v)
 Construct a pure quaternion given the vector part, scalar part = 0.
 quaternion (const scalar angleX, const scalar angleY, const scalar angleZ)
 Construct a quaternion given the three Euler angles.
 quaternion (Istream &)
 Construct from Istream.
scalar  w () const
 Scalar part of the quaternion ( = cos(theta/2) for rotation)
const vector &  v () const
 Vector part of the quaternion ( = axis of rotation)
tensor  R () const
 The rotation tensor corresponding the quaternion.
scalar &  w ()
 Scalar part of the quaternion ( = cos(theta/2) for rotation)
vector &  v ()
 Vector part of the quaternion ( = axis of rotation)
void  normalize ()
vector  transform (const vector &v) const
 Rotate the given vector.
vector  invTransform (const vector &v) const
 Rotate the given vector anti-clockwise.
quaternion  transform (const quaternion &q) const
 Rotate the given quaternion (and normalize)
quaternion  invTransform (const quaternion &q) const
 Rotate the given quaternion anti-clockwise (and normalize)
void  operator= (const quaternion &)
void  operator+= (const quaternion &)
void  operator-= (const quaternion &)
void  operator*= (const quaternion &)
void  operator/= (const quaternion &)
void  operator= (const scalar)
void  operator= (const vector &)
void  operator*= (const scalar)
void  operator/= (const scalar)

Static Public Attributes

static const char *const  typeName = "quaternion"
static const quaternion  zero
static const quaternion  I

Friends

Istream &  operator>> (Istream &is, quaternion &)
Ostream &  operator<< (Ostream &os, const quaternion &C)

Constructor & Destructor Documentation

quaternion (  ) [inline]

Construct null.

Definition at line 28 of file quaternionI.H.

quaternion ( const scalar   w,
const vector &   v  
) [inline]

Construct given scalar and vector parts.

Definition at line 31 of file quaternionI.H.

quaternion ( const vector &   d,
const scalar   theta  
) [inline]

Construct a rotation quaternion given the direction d.

and angle theta

Definition at line 37 of file quaternionI.H.

References quaternion::normalize().

quaternion ( const scalar   w  ) [inline, explicit]

Construct given scalar part, the vector part = vector::zero.

Definition at line 45 of file quaternionI.H.

quaternion ( const vector &   v  ) [inline, explicit]

Construct a pure quaternion given the vector part, scalar part = 0.

Definition at line 51 of file quaternionI.H.

quaternion ( const scalar   angleX,
const scalar   angleY,
const scalar   angleZ  
) [inline]

Construct a quaternion given the three Euler angles.

Definition at line 58 of file quaternionI.H.

quaternion ( Istream &   is  )

Construct from Istream.

Definition at line 38 of file quaternion.C.


Member Function Documentation

Foam::scalar w (  ) const [inline]
Foam::tensor R (  ) const [inline]

The rotation tensor corresponding the quaternion.

Definition at line 226 of file quaternionI.H.

References Foam::sqr(), and y.

Referenced by Foam::transform().

Foam::scalar & w (  ) [inline]

Scalar part of the quaternion ( = cos(theta/2) for rotation)

Definition at line 84 of file quaternionI.H.

Foam::vector & v (  ) [inline]

Vector part of the quaternion ( = axis of rotation)

Definition at line 90 of file quaternionI.H.

void normalize (  ) [inline]

Definition at line 96 of file quaternionI.H.

References Foam::mag().

Referenced by quaternion::quaternion().

Foam::vector transform ( const vector &   v  ) const [inline]

Rotate the given vector.

Definition at line 108 of file quaternionI.H.

References Foam::conjugate().

Referenced by Foam::operator*().

Foam::vector invTransform ( const vector &   v  ) const [inline]

Rotate the given vector anti-clockwise.

Definition at line 114 of file quaternionI.H.

References Foam::conjugate().

Referenced by Foam::inv().

Foam::quaternion transform ( const quaternion &   q  ) const [inline]

Rotate the given quaternion (and normalize)

Definition at line 120 of file quaternionI.H.

References Foam::normalize().

Foam::quaternion invTransform ( const quaternion &   q  ) const [inline]

Rotate the given quaternion anti-clockwise (and normalize)

Definition at line 127 of file quaternionI.H.

References Foam::conjugate(), and Foam::normalize().

void operator= ( const quaternion &   q  ) [inline]

Definition at line 137 of file quaternionI.H.

void operator+= ( const quaternion &   q  ) [inline]

Definition at line 143 of file quaternionI.H.

void operator-= ( const quaternion &   q  ) [inline]

Definition at line 149 of file quaternionI.H.

void operator*= ( const quaternion &   q  ) [inline]

Definition at line 155 of file quaternionI.H.

References quaternion::v(), and quaternion::w().

void operator/= ( const quaternion &   q  ) [inline]

Definition at line 162 of file quaternionI.H.

References Foam::inv().

void operator= ( const scalar   s  ) [inline]

Definition at line 168 of file quaternionI.H.

void operator= ( const vector &   v  ) [inline]

Definition at line 174 of file quaternionI.H.

void operator*= ( const scalar   s  ) [inline]

Definition at line 180 of file quaternionI.H.

void operator/= ( const scalar   s  ) [inline]

Definition at line 186 of file quaternionI.H.


Friends And Related Function Documentation

Istream& operator>> ( Istream &   is,
quaternion &    
) [friend]
Ostream& operator<< ( Ostream &   os,
const quaternion &   C  
) [friend]

Member Data Documentation

const char *const typeName = "quaternion" [static]

Definition at line 80 of file quaternion.H.

const Foam::quaternion zero [static]

Definition at line 82 of file quaternion.H.

const Foam::quaternion I [static]

Definition at line 83 of file quaternion.H.


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