SGQuat< T > Class Template Reference

Quaternion Class. More...

#include <SGQuat.hxx>

List of all members.

Public Member Functions

 SGQuat (void)
 Default constructor.
 SGQuat (T _x, T _y, T _z, T _w)
 Constructor. Initialize by the given values.
 SGQuat (const T *d)
 Constructor.
void getEulerRad (T &zRad, T &yRad, T &xRad) const
 write the euler angles into the references
void getEulerDeg (T &zDeg, T &yDeg, T &xDeg) const
 write the euler angles in degrees into the references
void getAngleAxis (T &angle, SGVec3< T > &axis) const
 write the angle axis representation into the references
void getAngleAxis (SGVec3< T > &axis) const
 write the angle axis representation into the references
const T & operator() (unsigned i) const
 Access by index, the index is unchecked.
T & operator() (unsigned i)
 Access by index, the index is unchecked.
const T & operator[] (unsigned i) const
 Access raw data by index, the index is unchecked.
T & operator[] (unsigned i)
 Access raw data by index, the index is unchecked.
const T & x (void) const
 Access the x component.
T & x (void)
 Access the x component.
const T & y (void) const
 Access the y component.
T & y (void)
 Access the y component.
const T & z (void) const
 Access the z component.
T & z (void)
 Access the z component.
const T & w (void) const
 Access the w component.
T & w (void)
 Access the w component.
const T(& data (void) const)[4]
 Get the data pointer.
T(& data (void))[4]
 Get the data pointer.
SGQuatoperator+= (const SGQuat &v)
 Inplace addition.
SGQuatoperator-= (const SGQuat &v)
 Inplace subtraction.
template<typename S >
SGQuatoperator*= (S s)
 Inplace scalar multiplication.
template<typename S >
SGQuatoperator/= (S s)
 Inplace scalar multiplication by 1/s.
SGQuatoperator*= (const SGQuat &v)
 Inplace quaternion multiplication.
SGVec3< T > transform (const SGVec3< T > &v) const
 Transform a vector from the current coordinate frame to a coordinate frame rotated with the quaternion.
SGVec3< T > backTransform (const SGVec3< T > &v) const
 Transform a vector from the coordinate frame rotated with the quaternion to the current coordinate frame.
SGVec3< T > rotate (const SGVec3< T > &v) const
 Rotate a given vector with the quaternion.
SGVec3< T > rotateBack (const SGVec3< T > &v) const
 Rotate a given vector with the inverse quaternion.
SGQuat derivative (const SGVec3< T > &angVel) const
 Return the time derivative of the quaternion given the angular velocity.

Static Public Member Functions

static SGQuat unit (void)
 Return a unit quaternion.
static SGQuat fromEulerRad (T z, T y, T x)
 Return a quaternion from euler angles.
static SGQuat fromEulerDeg (T z, T y, T x)
 Return a quaternion from euler angles in degrees.
static SGQuat fromYawPitchRoll (T y, T p, T r)
 Return a quaternion from euler angles.
static SGQuat fromYawPitchRollDeg (T y, T p, T r)
 Return a quaternion from euler angles.
static SGQuat fromHeadAttBank (T h, T a, T b)
 Return a quaternion from euler angles.
static SGQuat fromHeadAttBankDeg (T h, T a, T b)
 Return a quaternion from euler angles.
static SGQuat fromLonLatRad (T lon, T lat)
 Return a quaternion rotation from the earth centered to the simulation usual horizontal local frame from given longitude and latitude.
static SGQuat fromLonLatDeg (T lon, T lat)
 Like the above provided for convenience.
static SGQuat fromLonLat (const SGGeod &geod)
 Like the above provided for convenience.
static SGQuat fromAngleAxis (T angle, const SGVec3< T > &axis)
 Create a quaternion from the angle axis representation.
static SGQuat fromAngleAxisDeg (T angle, const SGVec3< T > &axis)
 Create a quaternion from the angle axis representation.
static SGQuat fromAngleAxis (const SGVec3< T > &axis)
 Create a quaternion from the angle axis representation where the angle is stored in the axis' length.
static SGQuat fromRotateTo (const SGVec3< T > &from, const SGVec3< T > &to)
 Return a quaternion that rotates the from vector onto the to vector.
static SGQuat fromRotateTo (const SGVec3< T > &v1, unsigned i1, const SGVec3< T > &v2, unsigned i2)
 Return a quaternion that rotates v1 onto the i1-th unit vector and v2 into a plane that is spanned by the i2-th and i1-th unit vector.
static SGQuat fromRealImag (T r, const SGVec3< T > &i)
 Return a quaternion from real and imaginary part.
static SGQuat zeros (void)
 Return an all zero vector.

Detailed Description

template<typename T>
class SGQuat< T >

Quaternion Class.

Definition at line 35 of file SGQuat.hxx.


Constructor & Destructor Documentation

template<typename T>
SGQuat< T >::SGQuat ( void   )  [inline]

Default constructor.

Does not initialize at all. If you need them zero initialized, SGQuat::zeros()

Initialize with nans in the debug build, that will guarantee to have a fast uninitialized default constructor in the release but shows up uninitialized values in the debug build very fast ...

Definition at line 41 of file SGQuat.hxx.

template<typename T>
SGQuat< T >::SGQuat ( const T *  d  )  [inline, explicit]

Constructor.

Initialize by the content of a plain array, make sure it has at least 4 elements

Definition at line 56 of file SGQuat.hxx.


Member Function Documentation

template<typename T>
static SGQuat SGQuat< T >::fromLonLatRad ( lon,
lat 
) [inline, static]

Return a quaternion rotation from the earth centered to the simulation usual horizontal local frame from given longitude and latitude.

The horizontal local frame used in simulations is the frame with x-axis pointing north, the y-axis pointing eastwards and the z axis pointing downwards.

Definition at line 108 of file SGQuat.hxx.

template<typename T>
static SGQuat SGQuat< T >::fromRotateTo ( const SGVec3< T > &  v1,
unsigned  i1,
const SGVec3< T > &  v2,
unsigned  i2 
) [inline, static]

Return a quaternion that rotates v1 onto the i1-th unit vector and v2 into a plane that is spanned by the i2-th and i1-th unit vector.

Definition at line 166 of file SGQuat.hxx.

template<typename T >
SGQuat< T > & SGQuat< T >::operator*= ( const SGQuat< T > &  v  )  [inline]

Inplace quaternion multiplication.

Now define the inplace multiplication.

Definition at line 556 of file SGQuat.hxx.


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

Generated on 23 Feb 2010 for SimGear by  doxygen 1.6.1