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

Rigid body 3-D position/transform. More...

#include <BodyPosition.hh>

Collaboration diagram for numeric::BodyPosition< 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
typedef xyzVector< T > Point
typedef xyzVector< T > Vector
typedef xyzVector< T > Translation
typedef xyzMatrix< T > Rotation
typedef numeric::Quaternion< T > Quaternion

Public Member Functions

 BodyPosition ()
 Default constructor.
 BodyPosition (Rotation const &R_a, Translation const &t_a)
 Rotation + Translation constructor.
 BodyPosition (Rotation const &R_a)
 Rotation constructor.
 BodyPosition (Quaternion const &q_a, Translation const &t_a)
 Quaternion + Translation constructor.
 BodyPosition (Quaternion const &q_a)
 Quaternion constructor.
 BodyPosition (Point const &p1, Vector const &x1, Vector const &u1, Point const &p2, Vector const &x2, Vector const &u2, Value const &cos, Value const &sin, Value const &csc)
 Point + Vector constructor.
 BodyPosition (BodyPosition const &bp)
 Copy constructor.
 ~BodyPosition ()
 Destructor.
BodyPositionoperator= (BodyPosition const &bp)
 Copy assignment.
Rotation const & R () const
 Rotation.
Quaternion const & q () const
 Quaternion.
Translation const & t () const
 Translation.
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])
BodyPosition const & operator() (Point &p) const
 Transform a Point.
BodyPosition const & transform (Point &p) const
 Transform a Point.
BodyPosition const & inverse_transform (Point &p) const
 Inverse transform a Point.
BodyPositionnormalize ()
 Normalize.
BodyPositionnormalize_if_needed (Value const &tol=Traits::quaternion_tolerance())
 Normalize if magnitude squared error exceeds tolerance.
BodyPositionto_identity ()
 Identity.
BodyPositioninvert ()
 Invert.
BodyPositionapply (BodyPosition const &p, bool const precise=true)
 Apply a successive BodyPosition transformation.
BodyPositionleft_transform_by (BodyPosition const &p, bool const precise=true)
 Left transform by a BodyPosition.
BodyPositionright_transform_by (BodyPosition const &p, bool const precise=true)
 Right transform by a BodyPosition.
BodyPositionleft_transform_by_inverse_of (BodyPosition const &p, bool const precise=true)
 Left transform by the inverse of a BodyPosition.
BodyPositionright_transform_by_inverse_of (BodyPosition const &p, bool const precise=true)
 Right transform by the inverse of a BodyPosition.
BodyPosition inverse () const
 Inverse.
Point transformed (Point const &p) const
 Transformed Point.
Point inverse_transformed (Point const &p) const
 Inverse transformed Point.
Translation inverse_translation () const
 Inverse translation.

Static Public Member Functions

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

Friends

bool operator== (BodyPosition const &p1, BodyPosition const &p2)
 BodyPosition == BodyPosition.
bool operator!= (BodyPosition const &p1, BodyPosition const &p2)
 BodyPosition != BodyPosition.

Detailed Description

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

Rigid body 3-D position/transform.

Remarks:
  • Dual personality: rotation matrix and quaternion representations
  • Rotation matrix is faster for transforming points
  • Quaternion is faster for successive frame transforms and easier to keep normalized
  • For quaternion q = ( w, x, y, z ) the equivalent rotation matrix is: 1-2( y^2 + z^2 ) 2( x y - w z ) 2( x z + w y ) 2( x y + w z ) 1-2( x^2 + z^2 ) 2( y z - w x ) 2( x z - w y ) 2( y z + w x ) 1-2( x^2 + y^2 )
  • Quaternions q and -q have the same rotation matrix
  • If an odd multiple of 2*pi is added to an angle the quaternion q is changed to -q
  • Invariant: The rotation matrix or quaternion or both must be "fresh" before and after every member function call

Member Typedef Documentation

template<typename T>
typedef xyzVector< T > numeric::BodyPosition< T >::Axis
template<typename T>
typedef T const* numeric::BodyPosition< T >::const_pointer
template<typename T>
typedef T const& numeric::BodyPosition< T >::const_reference
template<typename T>
typedef T const* numeric::BodyPosition< T >::ConstPointer
template<typename T>
typedef T const& numeric::BodyPosition< T >::ConstReference
template<typename T>
typedef xyzVector< T > numeric::BodyPosition< T >::Point
template<typename T>
typedef T* numeric::BodyPosition< T >::pointer
template<typename T>
typedef T* numeric::BodyPosition< T >::Pointer
template<typename T>
typedef T& numeric::BodyPosition< T >::Reference
template<typename T>
typedef T& numeric::BodyPosition< T >::reference
template<typename T>
typedef xyzMatrix< T > numeric::BodyPosition< T >::Rotation
template<typename T>
typedef NumericTraits< T > numeric::BodyPosition< T >::Traits
template<typename T>
typedef xyzVector< T > numeric::BodyPosition< T >::Translation
template<typename T>
typedef T numeric::BodyPosition< T >::Value
template<typename T>
typedef T numeric::BodyPosition< T >::value_type
template<typename T>
typedef xyzVector< T > numeric::BodyPosition< T >::Vector

Constructor & Destructor Documentation

template<typename T>
numeric::BodyPosition< T >::BodyPosition ( ) [inline]
template<typename T>
numeric::BodyPosition< T >::BodyPosition ( Rotation const &  R_a,
Translation const &  t_a 
) [inline]

Rotation + Translation constructor.

template<typename T>
numeric::BodyPosition< T >::BodyPosition ( Rotation const &  R_a) [inline]

Rotation constructor.

template<typename T>
numeric::BodyPosition< T >::BodyPosition ( Quaternion const &  q_a,
Translation const &  t_a 
) [inline]

Quaternion + Translation constructor.

template<typename T>
numeric::BodyPosition< T >::BodyPosition ( Quaternion const &  q_a) [inline]

Quaternion constructor.

template<typename T>
numeric::BodyPosition< T >::BodyPosition ( Point const &  p1,
Vector const &  x1,
Vector const &  u1,
Point const &  p2,
Vector const &  x2,
Vector const &  u2,
Value const &  cos,
Value const &  sin,
Value const &  csc 
) [inline]

Point + Vector constructor.

Note:
Constructs the transform that takes a point p and unit vectors x and u bound to p and separated by an angle on (0,pi) from position 1 to 2

References numeric::csc(), and basic::T().

template<typename T>
numeric::BodyPosition< T >::BodyPosition ( BodyPosition< T > const &  bp) [inline]

Copy constructor.

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

Destructor.


Member Function Documentation

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

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

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

template<typename T>
BodyPosition& numeric::BodyPosition< T >::apply ( BodyPosition< T > const &  p,
bool const  precise = true 
) [inline]

Apply a successive BodyPosition transformation.

References numeric::BodyPosition< T >::left_transform_by().

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

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

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

template<typename T>
Axis numeric::BodyPosition< T >::axis ( ) const [inline]

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

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

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

Identity BodyPosition for expressions.

Note:
Default and identity() named constructors can be faster for construction
Can be safely used in construction of global objects
template<typename T>
static BodyPosition numeric::BodyPosition< T >::identity ( ) [inline, static]

Identity named constructor.

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

template<typename T>
BodyPosition numeric::BodyPosition< T >::inverse ( ) const [inline]
template<typename T>
BodyPosition const& numeric::BodyPosition< T >::inverse_transform ( Point p) const [inline]
template<typename T>
Point numeric::BodyPosition< T >::inverse_transformed ( Point const &  p) const [inline]

Inverse transformed Point.

References numeric::transpose_product().

template<typename T>
Translation numeric::BodyPosition< T >::inverse_translation ( ) const [inline]
template<typename T>
BodyPosition& numeric::BodyPosition< T >::invert ( ) [inline]
template<typename T>
BodyPosition& numeric::BodyPosition< T >::left_transform_by ( BodyPosition< T > const &  p,
bool const  precise = true 
) [inline]
template<typename T>
BodyPosition& numeric::BodyPosition< T >::left_transform_by_inverse_of ( BodyPosition< T > const &  p,
bool const  precise = true 
) [inline]
template<typename T>
BodyPosition& numeric::BodyPosition< T >::normalize ( ) [inline]

Normalize.

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

template<typename T>
BodyPosition& numeric::BodyPosition< T >::normalize_if_needed ( Value const &  tol = Traits::quaternion_tolerance()) [inline]

Normalize if magnitude squared error exceeds tolerance.

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

template<typename T>
BodyPosition const& numeric::BodyPosition< T >::operator() ( Point p) const [inline]

Transform a Point.

References numeric::inplace_product().

template<typename T>
BodyPosition& numeric::BodyPosition< T >::operator= ( BodyPosition< T > const &  bp) [inline]

Copy assignment.

template<typename T>
Quaternion const& numeric::BodyPosition< T >::q ( ) const [inline]
template<typename T>
Rotation const& numeric::BodyPosition< T >::R ( ) const [inline]

Rotation.

template<typename T>
BodyPosition& numeric::BodyPosition< T >::right_transform_by ( BodyPosition< T > const &  p,
bool const  precise = true 
) [inline]
template<typename T>
BodyPosition& numeric::BodyPosition< T >::right_transform_by_inverse_of ( BodyPosition< T > const &  p,
bool const  precise = true 
) [inline]
template<typename T>
Translation const& numeric::BodyPosition< T >::t ( ) const [inline]

Translation.

template<typename T>
BodyPosition& numeric::BodyPosition< T >::to_identity ( ) [inline]
template<typename T>
BodyPosition const& numeric::BodyPosition< T >::transform ( Point p) const [inline]
template<typename T>
Point numeric::BodyPosition< T >::transformed ( Point const &  p) const [inline]

Transformed Point.

References numeric::product().

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


Friends And Related Function Documentation

template<typename T>
bool operator!= ( BodyPosition< T > const &  p1,
BodyPosition< T > const &  p2 
) [friend]
template<typename T>
bool operator== ( BodyPosition< T > const &  p1,
BodyPosition< T > const &  p2 
) [friend]

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