Rosetta  2020.37
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | Friends | List of all members
numeric::Quaternion< typename > Class Template Reference

Unit quaternion 3-D orientation representation. More...

#include <Quaternion.hh>

Public Types

typedef T Value
 
typedef TReference
 
typedef T const & ConstReference
 
typedef TPointer
 
typedef T const * ConstPointer
 
typedef T value_type
 
typedef Treference
 
typedef T const & const_reference
 
typedef Tpointer
 
typedef T const * const_pointer
 
typedef NumericTraits< TTraits
 
typedef xyzVector< TAxis
 

Public Member Functions

 Quaternion ()
 Default constructor. More...
 
 Quaternion (Value const &w_a, Value const &x_a, Value const &y_a, Value const &z_a, bool const precise=true)
 Coordinate constructor. More...
 
 Quaternion (Axis const &u, Value const &angle, bool const precise=true)
 
 Quaternion (Quaternion const &q)
 Copy constructor. More...
 
 ~Quaternion ()
 Destructor. More...
 
Quaternionoperator= (Quaternion const &q)
 
void w (Value newval)
 w More...
 
void x (Value newval)
 x More...
 
void y (Value newval)
 y More...
 
void z (Value newval)
 z More...
 
Value const & w () const
 w More...
 
Value const & x () const
 x More...
 
Value const & y () const
 y More...
 
Value const & z () const
 z More...
 
Value w_squared () const
 w squared More...
 
Value x_squared () const
 x squared More...
 
Value y_squared () const
 y squared More...
 
Value z_squared () const
 z squared More...
 
Value norm () const
 Norm: Should be one. More...
 
Value norm_squared () const
 Norm squared: Should be one. More...
 
Value norm_error () const
 Norm error. More...
 
Value norm_squared_error () const
 Norm squared error. More...
 
Value magnitude () const
 Magnitude: Should be one. More...
 
Value magnitude_squared () const
 Magnitude squared: Should be one. More...
 
Value magnitude_error () const
 Magnitude error. More...
 
Value magnitude_squared_error () const
 Magnitude squared error. More...
 
bool is_normalized (Value const &tol=Traits::quaternion_tolerance()) const
 Magnitude squared error within tolerance? More...
 
bool not_normalized (Value const &tol=Traits::quaternion_tolerance()) const
 Magnitude squared error exceeds tolerance? More...
 
Value angle () const
 Principal angle of rotation (on [0,2*pi]) More...
 
Axis axis () const
 Axis of Rotation unit vector (direction for angle on [0,2*pi]) More...
 
Axisaxis (Axis &u) const
 Axis of rotation unit vector: Passed vector (direction for angle on [0,2*pi]) More...
 
std::string to_string () const
 to_string, useful for utility exits More...
 
Value dot (Quaternion const &q) const
 Dot product. More...
 
Value dot_product (Quaternion const &q) const
 Dot product. More...
 
Quaternionnormalize ()
 Normalize. More...
 
Quaternionnormalize_if_needed (Value const &tol=Traits::quaternion_tolerance())
 Normalize if magnitude squared error exceeds tolerance. More...
 
Quaternionto_identity ()
 Identity. More...
 
Quaternionconjugate ()
 Conjugate. More...
 
Quaternioninvert ()
 Invert. More...
 
Quaternionapply (Quaternion const &q, bool const precise=true)
 Apply a successive Quaternion. More...
 
Quaternionleft_multiply_by (Quaternion const &q, bool const precise=true)
 Left multiply by a Quaternion. More...
 
Quaternionright_multiply_by (Quaternion const &q, bool const precise=true)
 Right multiply by a Quaternion. More...
 
Quaternionleft_multiply_by_inverse_of (Quaternion const &q, bool const precise=true)
 Left multiply by the inverse of a Quaternion. More...
 
Quaternionright_multiply_by_inverse_of (Quaternion const &q, bool const precise=true)
 Right multiply by the inverse of a Quaternion. More...
 
void swap (Quaternion &q)
 Swap. More...
 
Quaternion conjugated () const
 Conjugated. More...
 
Quaternion inverse () const
 Inverse. More...
 

Static Public Member Functions

static Quaternion identity ()
 Identity named constructor. More...
 
static Quaternion const & I ()
 Identity Quaternion for expressions. More...
 

Private Attributes

Value w_
 w coordinate More...
 
Value x_
 x coordinate More...
 
Value y_
 y coordinate More...
 
Value z_
 z coordinate More...
 

Friends

class BodyPosition< T >
 
template<class U >
Quaternion< U > operator* (Quaternion< U > const &q2, Quaternion< U > const &q1)
 Quaternion * Quaternion (always normalizes return value) More...
 
template<class U >
Quaternion< U > product (Quaternion< U > const &q2, Quaternion< U > const &q1, bool const precise=true)
 Product: Quaternion * Quaternion. More...
 
template<class U >
bool operator== (Quaternion< U > const &q1, Quaternion< U > const &q2)
 Quaternion == Quaternion. More...
 
template<class U >
bool operator!= (Quaternion< U > const &q1, Quaternion< U > const &q2)
 Quaternion != Quaternion. More...
 
template<class U >
Value dot (Quaternion< U > const &q1, Quaternion< U > const &q2)
 Dot product. More...
 
template<class U >
Value dot_product (Quaternion< U > const &q1, Quaternion< U > const &q2)
 Dot product. More...
 

Detailed Description

template<typename>
class numeric::Quaternion< typename >

Unit quaternion 3-D orientation representation.

Remarks
  • Quaternion defined as ( w, x, y, z )
  • Quaternions must be in the same coordinate frame to be used together
  • Successive rotation convention: q2 * q1 means q1 followed by q2
  • Performance-critical code can suppress normalization after every modification and use explicit normalization

Member Typedef Documentation

template<typename >
typedef xyzVector< T > numeric::Quaternion< typename >::Axis
template<typename >
typedef T const* numeric::Quaternion< typename >::const_pointer
template<typename >
typedef T const& numeric::Quaternion< typename >::const_reference
template<typename >
typedef T const* numeric::Quaternion< typename >::ConstPointer
template<typename >
typedef T const& numeric::Quaternion< typename >::ConstReference
template<typename >
typedef T* numeric::Quaternion< typename >::Pointer
template<typename >
typedef T* numeric::Quaternion< typename >::pointer
template<typename >
typedef T& numeric::Quaternion< typename >::Reference
template<typename >
typedef T& numeric::Quaternion< typename >::reference
template<typename >
typedef NumericTraits< T > numeric::Quaternion< typename >::Traits
template<typename >
typedef T numeric::Quaternion< typename >::Value
template<typename >
typedef T numeric::Quaternion< typename >::value_type

Constructor & Destructor Documentation

template<typename >
numeric::Quaternion< typename >::Quaternion ( )
inline
template<typename >
numeric::Quaternion< typename >::Quaternion ( Value const &  w_a,
Value const &  x_a,
Value const &  y_a,
Value const &  z_a,
bool const  precise = true 
)
inline

Coordinate constructor.

template<typename >
numeric::Quaternion< typename >::Quaternion ( Axis const &  u,
Value const &  angle,
bool const  precise = true 
)
inline
template<typename >
numeric::Quaternion< typename >::Quaternion ( Quaternion< typename > const &  q)
inline

Copy constructor.

template<typename >
numeric::Quaternion< typename >::~Quaternion ( )
inline

Destructor.

Member Function Documentation

template<typename >
Value numeric::Quaternion< typename >::angle ( ) const
inline

Principal angle of rotation (on [0,2*pi])

Referenced by numeric::BodyPosition< typename >::angle().

template<typename >
Quaternion& numeric::Quaternion< typename >::apply ( Quaternion< typename > const &  q,
bool const  precise = true 
)
inline
template<typename >
Axis numeric::Quaternion< typename >::axis ( ) const
inline

Axis of Rotation unit vector (direction for angle on [0,2*pi])

Referenced by numeric::BodyPosition< typename >::axis().

template<typename >
Axis& numeric::Quaternion< typename >::axis ( Axis u) const
inline

Axis of rotation unit vector: Passed vector (direction for angle on [0,2*pi])

template<typename >
Quaternion& numeric::Quaternion< typename >::conjugate ( )
inline

Conjugate.

template<typename >
Quaternion numeric::Quaternion< typename >::conjugated ( ) const
inline

Conjugated.

template<typename >
Value numeric::Quaternion< typename >::dot ( Quaternion< typename > const &  q) const
inline

Dot product.

template<typename >
Value numeric::Quaternion< typename >::dot_product ( Quaternion< typename > const &  q) const
inline

Dot product.

template<typename >
static Quaternion const& numeric::Quaternion< typename >::I ( )
inlinestatic

Identity Quaternion for expressions.

Note
Default and identity() named constructors can be faster for construction
Can be safely used in construction of global objects
template<typename >
static Quaternion numeric::Quaternion< typename >::identity ( )
inlinestatic

Identity named constructor.

template<typename >
Quaternion numeric::Quaternion< typename >::inverse ( ) const
inline

Inverse.

template<typename >
Quaternion& numeric::Quaternion< typename >::invert ( )
inline
template<typename >
bool numeric::Quaternion< typename >::is_normalized ( Value const &  tol = Traits::quaternion_tolerance()) const
inline

Magnitude squared error within tolerance?

Referenced by numeric::Quaternion< T >::Quaternion().

template<typename >
Quaternion& numeric::Quaternion< typename >::left_multiply_by ( Quaternion< typename > const &  q,
bool const  precise = true 
)
inline
template<typename >
Quaternion& numeric::Quaternion< typename >::left_multiply_by_inverse_of ( Quaternion< typename > const &  q,
bool const  precise = true 
)
inline

Left multiply by the inverse of a Quaternion.

Referenced by numeric::BodyPosition< typename >::left_transform_by_inverse_of().

template<typename >
Value numeric::Quaternion< typename >::magnitude ( ) const
inline

Magnitude: Should be one.

Referenced by numeric::Quaternion< T >::magnitude_error().

template<typename >
Value numeric::Quaternion< typename >::magnitude_error ( ) const
inline

Magnitude error.

template<typename >
Value numeric::Quaternion< typename >::magnitude_squared ( ) const
inline

Magnitude squared: Should be one.

Referenced by numeric::Quaternion< T >::magnitude_squared_error().

template<typename >
Value numeric::Quaternion< typename >::magnitude_squared_error ( ) const
inline

Magnitude squared error.

template<typename >
Value numeric::Quaternion< typename >::norm ( ) const
inline

Norm: Should be one.

Referenced by numeric::Quaternion< T >::norm_error().

template<typename >
Value numeric::Quaternion< typename >::norm_error ( ) const
inline

Norm error.

template<typename >
Value numeric::Quaternion< typename >::norm_squared ( ) const
inline
template<typename >
Value numeric::Quaternion< typename >::norm_squared_error ( ) const
inline
template<typename >
Quaternion& numeric::Quaternion< typename >::normalize ( )
inline
template<typename >
Quaternion& numeric::Quaternion< typename >::normalize_if_needed ( Value const &  tol = Traits::quaternion_tolerance())
inline

Normalize if magnitude squared error exceeds tolerance.

Referenced by numeric::BodyPosition< typename >::normalize_if_needed().

template<typename >
bool numeric::Quaternion< typename >::not_normalized ( Value const &  tol = Traits::quaternion_tolerance()) const
inline

Magnitude squared error exceeds tolerance?

template<typename >
Quaternion& numeric::Quaternion< typename >::operator= ( Quaternion< typename > const &  q)
inline
template<typename >
Quaternion& numeric::Quaternion< typename >::right_multiply_by ( Quaternion< typename > const &  q,
bool const  precise = true 
)
inline
template<typename >
Quaternion& numeric::Quaternion< typename >::right_multiply_by_inverse_of ( Quaternion< typename > const &  q,
bool const  precise = true 
)
inline

Right multiply by the inverse of a Quaternion.

Referenced by numeric::BodyPosition< typename >::right_transform_by_inverse_of().

template<typename >
void numeric::Quaternion< typename >::swap ( Quaternion< typename > &  q)
inline

Swap.

template<typename >
Quaternion& numeric::Quaternion< typename >::to_identity ( )
inline
template<typename >
std::string numeric::Quaternion< typename >::to_string ( ) const
inline

to_string, useful for utility exits

template<typename >
void numeric::Quaternion< typename >::w ( Value  newval)
inline
template<typename >
Value const& numeric::Quaternion< typename >::w ( ) const
inline

w

template<typename >
Value numeric::Quaternion< typename >::w_squared ( ) const
inline

w squared

template<typename >
void numeric::Quaternion< typename >::x ( Value  newval)
inline
template<typename >
Value const& numeric::Quaternion< typename >::x ( ) const
inline

x

template<typename >
Value numeric::Quaternion< typename >::x_squared ( ) const
inline

x squared

template<typename >
void numeric::Quaternion< typename >::y ( Value  newval)
inline
template<typename >
Value const& numeric::Quaternion< typename >::y ( ) const
inline

y

template<typename >
Value numeric::Quaternion< typename >::y_squared ( ) const
inline

y squared

template<typename >
void numeric::Quaternion< typename >::z ( Value  newval)
inline
template<typename >
Value const& numeric::Quaternion< typename >::z ( ) const
inline

z

template<typename >
Value numeric::Quaternion< typename >::z_squared ( ) const
inline

z squared

Friends And Related Function Documentation

template<typename >
friend class BodyPosition< T >
friend
template<typename >
template<class U >
Value dot ( Quaternion< U > const &  q1,
Quaternion< U > const &  q2 
)
friend

Dot product.

template<typename >
template<class U >
Value dot_product ( Quaternion< U > const &  q1,
Quaternion< U > const &  q2 
)
friend

Dot product.

template<typename >
template<class U >
bool operator!= ( Quaternion< U > const &  q1,
Quaternion< U > const &  q2 
)
friend
template<typename >
template<class U >
Quaternion<U> operator* ( Quaternion< U > const &  q2,
Quaternion< U > const &  q1 
)
friend

Quaternion * Quaternion (always normalizes return value)

template<typename >
template<class U >
bool operator== ( Quaternion< U > const &  q1,
Quaternion< U > const &  q2 
)
friend
template<typename >
template<class U >
Quaternion<U> product ( Quaternion< U > const &  q2,
Quaternion< U > const &  q1,
bool const  precise = true 
)
friend

Product: Quaternion * Quaternion.

Member Data Documentation

template<typename >
Value numeric::Quaternion< typename >::w_
private
template<typename >
Value numeric::Quaternion< typename >::x_
private
template<typename >
Value numeric::Quaternion< typename >::y_
private
template<typename >
Value numeric::Quaternion< typename >::z_
private

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