All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Typedefs
Quaternion

Classes

class  blaze::Quaternion< Type >
 Efficient implementation of a quaternion.Quaternions are a superior way to deal with rotations and orientations. This quaternion consists of 4 statically allocated elements, where the first element represents the real part and the three other elements represent the three imaginary parts. The naming convention of the elements is as following: More...
 

Typedefs

typedef Quaternion< real > blaze::Quat
 Quaternion of real type.
 

Quaternion operators

template<typename T1 , typename T2 >
bool blaze::operator== (const Quaternion< T1 > &lhs, const Quaternion< T2 > &rhs)
 Equality operator for the comparison of two quaternions.
 
template<typename T1 , typename T2 >
bool blaze::operator!= (const Quaternion< T1 > &lhs, const Quaternion< T2 > &rhs)
 Inequality operator for the comparison of two quaternions.
 
template<typename Type >
std::ostream & blaze::operator<< (std::ostream &os, const Quaternion< Type > &q)
 Global output operator for quaternions.
 
template<typename Type >
std::istream & blaze::operator>> (std::istream &is, Quaternion< Type > &q)
 Global input operator for quaternions.
 
template<typename Type >
bool blaze::isnan (const Quaternion< Type > &q)
 Checks the given quaternion for not-a-number elements.
 
template<typename Type >
void blaze::reset (Quaternion< Type > &q)
 Resetting the given quaternion.
 
template<typename Type >
void blaze::clear (Quaternion< Type > &q)
 Clearing the given quaternion.
 
template<typename Type >
bool blaze::isDefault (const Quaternion< Type > &q)
 Returns whether the given quaternion is in default state.
 
template<typename Type >
const Quaternion< Type > blaze::inv (const Quaternion< Type > &q)
 Inverting the given quaternion ( $ \hat{q} = \hat{p}^{-1} $).
 
template<typename Type >
const Quaternion< Type > blaze::sq (const Quaternion< Type > &q)
 Squaring the given quaternion.
 
template<typename Type >
void blaze::swap (Quaternion< Type > &a, Quaternion< Type > &b)
 Swapping the contents of two quaternions.
 

Quaternion arithmetic operators

template<typename T1 , typename T2 >
const Quaternion< typename
MultTrait< T1, T2 >::Type > 
blaze::operator* (const Quaternion< T1 > &lhs, const Quaternion< T2 > &rhs)
 Multiplication operator for the multiplication of two quaternions ( $ \hat{q}=\hat{p}*\hat{r} $).
 

Detailed Description

Function Documentation

template<typename Type >
void blaze::clear ( Quaternion< Type > &  q)
inline

Clearing the given quaternion.

Parameters
qThe quaternion to be cleared.
Returns
void

Clearing a quaternion is equivalent to resetting it via the reset() function.

template<typename Type >
const Quaternion< Type > blaze::inv ( const Quaternion< Type > &  q)
inline

Inverting the given quaternion ( $ \hat{q} = \hat{p}^{-1} $).

Parameters
qThe quaternion to be inverted.
Returns
The inverse quaternion.

This function returns the inverse of the given quaternion.

template<typename Type >
bool blaze::isDefault ( const Quaternion< Type > &  q)
inline

Returns whether the given quaternion is in default state.

Parameters
qThe quaternion to be tested for its default state.
Returns
true in case the given quaternion is in default state, false otherwise.

The function returns true in case the real part of the quaternion is 1 and the imaginary parts are 0, otherwise it returns false.

\[\left(\begin{array}{*{4}{c}} 1 & 0 & 0 & 0 \\ \end{array}\right)\]

template<typename Type >
bool blaze::isnan ( const Quaternion< Type > &  q)
inline

Checks the given quaternion for not-a-number elements.

Parameters
qThe quaternion to be checked for not-a-number elements.
Returns
true if at least one element of the quaternion is not-a-number, false otherwise.
template<typename T1 , typename T2 >
bool blaze::operator!= ( const Quaternion< T1 > &  lhs,
const Quaternion< T2 > &  rhs 
)
inline

Inequality operator for the comparison of two quaternions.

Parameters
lhsThe left-hand side quaternion for the comparison.
rhsThe right-hand side quaternion for the comparison.
Returns
true if the two quaternions are not equal, false if they are equal.
template<typename T1 , typename T2 >
const Quaternion< typename MultTrait< T1, T2 >::Type > blaze::operator* ( const Quaternion< T1 > &  lhs,
const Quaternion< T2 > &  rhs 
)
inline

Multiplication operator for the multiplication of two quaternions ( $ \hat{q}=\hat{p}*\hat{r} $).

Parameters
lhsThe left-hand side quaternion for the multiplication.
rhsThe right-hand side quaternion for the multiplication.
Returns
The resulting quaternion.
template<typename Type >
std::ostream & blaze::operator<< ( std::ostream &  os,
const Quaternion< Type > &  q 
)

Global output operator for quaternions.

Parameters
osReference to the output stream.
qReference to a constant quaternion object.
Returns
Reference to the output stream.
template<typename T1 , typename T2 >
bool blaze::operator== ( const Quaternion< T1 > &  lhs,
const Quaternion< T2 > &  rhs 
)
inline

Equality operator for the comparison of two quaternions.

Parameters
lhsThe left-hand side quaternion for the comparison.
rhsThe right-hand side quaternion for the comparison.
Returns
true if the two quaternions are equal, false if not.
template<typename Type >
std::istream & blaze::operator>> ( std::istream &  is,
Quaternion< Type > &  q 
)

Global input operator for quaternions.

Parameters
isReference to the input stream.
qReference to a quaternion object.
Returns
The input stream.
template<typename Type >
void blaze::reset ( Quaternion< Type > &  q)
inline

Resetting the given quaternion.

Parameters
qThe quaternion to be resetted.
Returns
void
template<typename Type >
const Quaternion< Type > blaze::sq ( const Quaternion< Type > &  q)
inline

Squaring the given quaternion.

Parameters
qThe quaternion to be squared.
Returns
The result of the square operation.

This function squares the given quaternion q. This function has the same effect as multiplying the quaternion with itself ( $ q * q $).

template<typename Type >
void blaze::swap ( Quaternion< Type > &  a,
Quaternion< Type > &  b 
)
inline

Swapping the contents of two quaternions.

Parameters
aThe first quaternion to be swapped.
bThe second quaternion to be swapped.
Returns
void
Exceptions
no-throwguarantee.