Rosetta
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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.fwd.hh>

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. 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 (Quaternion const &q)
 Copy constructor. More...
 
 ~Quaternion ()
 Destructor. More...
 
Quaternionoperator= (Quaternion const &q)
 
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...
 
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 >
 
Quaternion operator* (Quaternion const &q2, Quaternion const &q1)
 Quaternion * Quaternion. More...
 
Quaternion product (Quaternion const &q2, Quaternion const &q1, bool const precise=true)
 Product: Quaternion * Quaternion. More...
 
bool operator== (Quaternion const &q1, Quaternion const &q2)
 Quaternion == Quaternion. More...
 
bool operator!= (Quaternion const &q1, Quaternion const &q2)
 Quaternion != Quaternion. More...
 
Value dot (Quaternion const &q1, Quaternion const &q2)
 Dot product. More...
 
Value dot_product (Quaternion const &q1, Quaternion 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

Definition at line 23 of file Quaternion.fwd.hh.

Member Typedef Documentation

template<typename >
typedef xyzVector< T > numeric::Quaternion< typename >::Axis

Definition at line 75 of file Quaternion.hh.

template<typename >
typedef T const* numeric::Quaternion< typename >::const_pointer

Definition at line 69 of file Quaternion.hh.

template<typename >
typedef T const& numeric::Quaternion< typename >::const_reference

Definition at line 67 of file Quaternion.hh.

template<typename >
typedef T const* numeric::Quaternion< typename >::ConstPointer

Definition at line 62 of file Quaternion.hh.

template<typename >
typedef T const& numeric::Quaternion< typename >::ConstReference

Definition at line 60 of file Quaternion.hh.

template<typename >
typedef T* numeric::Quaternion< typename >::Pointer

Definition at line 61 of file Quaternion.hh.

template<typename >
typedef T* numeric::Quaternion< typename >::pointer

Definition at line 68 of file Quaternion.hh.

template<typename >
typedef T& numeric::Quaternion< typename >::Reference

Definition at line 59 of file Quaternion.hh.

template<typename >
typedef T& numeric::Quaternion< typename >::reference

Definition at line 66 of file Quaternion.hh.

template<typename >
typedef NumericTraits< T > numeric::Quaternion< typename >::Traits

Definition at line 72 of file Quaternion.hh.

template<typename >
typedef T numeric::Quaternion< typename >::Value

Definition at line 58 of file Quaternion.hh.

template<typename >
typedef T numeric::Quaternion< typename >::value_type

Definition at line 65 of file Quaternion.hh.

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.

Definition at line 93 of file Quaternion.hh.

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

Copy constructor.

Definition at line 122 of file Quaternion.hh.

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

Destructor.

Definition at line 132 of file Quaternion.hh.

Member Function Documentation

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

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

Definition at line 320 of file Quaternion.hh.

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

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

Apply a successive Quaternion.

Definition at line 444 of file Quaternion.hh.

Referenced by src.protocols.jd2.RosettaScriptWrapper::apply_to_failure().

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

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

Definition at line 329 of file Quaternion.hh.

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])

Definition at line 338 of file Quaternion.hh.

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

Conjugate.

Definition at line 420 of file Quaternion.hh.

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

Conjugated.

Definition at line 537 of file Quaternion.hh.

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

Dot product.

Definition at line 350 of file Quaternion.hh.

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

Dot product.

Definition at line 359 of file Quaternion.hh.

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

Definition at line 597 of file Quaternion.hh.

template<typename >
static Quaternion numeric::Quaternion< typename >::identity ( )
inlinestatic

Identity named constructor.

Definition at line 114 of file Quaternion.hh.

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

Inverse.

Definition at line 546 of file Quaternion.hh.

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

Invert.

Definition at line 432 of file Quaternion.hh.

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

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

Magnitude squared error within tolerance?

Definition at line 302 of file Quaternion.hh.

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.

Definition at line 487 of file Quaternion.hh.

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

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

Magnitude: Should be one.

Definition at line 266 of file Quaternion.hh.

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

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

Magnitude error.

Definition at line 284 of file Quaternion.hh.

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

Magnitude squared: Should be one.

Definition at line 275 of file Quaternion.hh.

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

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

Magnitude squared error.

Definition at line 293 of file Quaternion.hh.

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

Norm: Should be one.

Definition at line 230 of file Quaternion.hh.

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

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

Norm error.

Definition at line 248 of file Quaternion.hh.

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

Norm squared error.

Definition at line 257 of file Quaternion.hh.

Referenced by numeric::Quaternion< T >::is_normalized(), and numeric::Quaternion< T >::not_normalized().

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.

Definition at line 389 of file Quaternion.hh.

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?

Definition at line 311 of file Quaternion.hh.

template<typename >
Quaternion& numeric::Quaternion< typename >::operator= ( Quaternion< typename > const &  q)
inline

Definition at line 140 of file Quaternion.hh.

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

Right multiply by a Quaternion.

Definition at line 470 of file Quaternion.hh.

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

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.

Definition at line 504 of file Quaternion.hh.

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

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

Swap.

Definition at line 521 of file Quaternion.hh.

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

Identity.

Definition at line 407 of file Quaternion.hh.

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

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

w

Definition at line 158 of file Quaternion.hh.

Referenced by numeric::operator>>(), and numeric::random::random_rotation().

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

w squared

Definition at line 194 of file Quaternion.hh.

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

x

Definition at line 167 of file Quaternion.hh.

Referenced by numeric::operator>>(), and numeric::random::random_rotation().

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

x squared

Definition at line 203 of file Quaternion.hh.

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

y

Definition at line 176 of file Quaternion.hh.

Referenced by numeric::operator>>(), and numeric::random::random_rotation().

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

y squared

Definition at line 212 of file Quaternion.hh.

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

z

Definition at line 185 of file Quaternion.hh.

Referenced by numeric::operator>>(), and numeric::random::random_rotation().

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

z squared

Definition at line 221 of file Quaternion.hh.

Friends And Related Function Documentation

template<typename >
friend class BodyPosition< T >
friend

Definition at line 51 of file Quaternion.hh.

template<typename >
Value dot ( Quaternion< typename > const &  q1,
Quaternion< typename > const &  q2 
)
friend

Dot product.

Definition at line 631 of file Quaternion.hh.

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

Dot product.

Definition at line 641 of file Quaternion.hh.

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

Quaternion != Quaternion.

Definition at line 621 of file Quaternion.hh.

template<typename >
Quaternion operator* ( Quaternion< typename > const &  q2,
Quaternion< typename > const &  q1 
)
friend

Quaternion * Quaternion.

Definition at line 556 of file Quaternion.hh.

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

Quaternion == Quaternion.

Definition at line 611 of file Quaternion.hh.

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

Product: Quaternion * Quaternion.

Definition at line 571 of file Quaternion.hh.

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: