Rosetta 3.3
Public Types | Public Member Functions | Static Public Member Functions | Friends
numeric::Quaternion< T > Class Template Reference

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

#include <Quaternion.hh>

Collaboration diagram for numeric::Quaternion< T >:
Collaboration graph
[legend]

List of all members.

Public Types

typedefValue
typedef T & Reference
typedef T const & ConstReference
typedef T * Pointer
typedef T const * ConstPointer
typedefvalue_type
typedef T & reference
typedef T const & const_reference
typedef T * pointer
typedef T const * const_pointer
typedef NumericTraits< T > Traits
typedef xyzVector< T > Axis

Public Member Functions

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

Static Public Member Functions

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

Friends

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

Detailed Description

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

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

Constructor & Destructor Documentation

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

Copy constructor.

template<typename T>
numeric::Quaternion< T >::~Quaternion ( ) [inline]

Destructor.


Member Function Documentation

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

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

References basic::T().

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

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

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

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

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

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

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

Conjugate.

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

Conjugated.

References numeric::Quaternion< T >::Quaternion().

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

Dot product.

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

Dot product.

template<typename T>
static Quaternion const& numeric::Quaternion< T >::I ( ) [inline, static]

Identity Quaternion for expressions.

Note:
Default and identity() named constructors can be faster for construction
Can be safely used in construction of global objects

References basic::T().

template<typename T>
static Quaternion numeric::Quaternion< T >::identity ( ) [inline, static]

Identity named constructor.

References numeric::Quaternion< T >::Quaternion(), and basic::T().

template<typename T>
Quaternion numeric::Quaternion< T >::inverse ( ) const [inline]
template<typename T>
Quaternion& numeric::Quaternion< T >::invert ( ) [inline]

Invert.

Referenced by numeric::BodyPosition< T >::invert().

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

Magnitude squared error within tolerance?

References numeric::Quaternion< T >::norm_squared_error(), and loops_kic::tol.

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

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

Magnitude: Should be one.

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

template<typename T>
Value numeric::Quaternion< T >::magnitude_error ( ) const [inline]
template<typename T>
Value numeric::Quaternion< T >::magnitude_squared ( ) const [inline]

Magnitude squared: Should be one.

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

template<typename T>
Value numeric::Quaternion< T >::magnitude_squared_error ( ) const [inline]
template<typename T>
Value numeric::Quaternion< T >::norm ( ) const [inline]

Norm: Should be one.

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

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

Normalize if magnitude squared error exceeds tolerance.

References ObjexxFCL::abs(), numeric::Quaternion< T >::norm_squared(), basic::T(), and loops_kic::tol.

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

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

Magnitude squared error exceeds tolerance?

References numeric::Quaternion< T >::norm_squared_error(), and loops_kic::tol.

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

Swap.

References sd::t.

template<typename T>
Quaternion& numeric::Quaternion< T >::to_identity ( ) [inline]

Identity.

References basic::T().

Referenced by numeric::BodyPosition< T >::to_identity().

template<typename T>
Value const& numeric::Quaternion< T >::w ( ) const [inline]

w

Referenced by numeric::operator>>().

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

w squared

template<typename T>
Value const& numeric::Quaternion< T >::x ( ) const [inline]

x

Referenced by numeric::operator>>().

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

x squared

template<typename T>
Value const& numeric::Quaternion< T >::y ( ) const [inline]

y

Referenced by numeric::operator>>().

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

y squared

template<typename T>
Value const& numeric::Quaternion< T >::z ( ) const [inline]

z

Referenced by numeric::operator>>().

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

z squared


Friends And Related Function Documentation

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

Dot product.

template<typename T>
Value dot_product ( Quaternion< T > const &  q1,
Quaternion< T > const &  q2 
) [friend]

Dot product.

template<typename T>
bool operator!= ( Quaternion< T > const &  q1,
Quaternion< T > const &  q2 
) [friend]
template<typename T>
Quaternion operator* ( Quaternion< T > const &  q2,
Quaternion< T > const &  q1 
) [friend]
template<typename T>
bool operator== ( Quaternion< T > const &  q1,
Quaternion< T > const &  q2 
) [friend]
template<typename T>
Quaternion product ( Quaternion< T > const &  q2,
Quaternion< T > const &  q1,
bool const  precise = true 
) [friend]

Product: Quaternion * Quaternion.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines