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

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

#include <BodyPosition.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
 
typedef xyzVector< TPoint
 
typedef xyzVector< TVector
 
typedef xyzVector< TTranslation
 
typedef xyzMatrix< TRotation
 
typedef numeric::Quaternion< TQuaternion
 

Public Member Functions

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

Static Public Member Functions

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

Private Member Functions

BodyPosition const & R_refresh (bool const precise=true) const
 Refresh rotation matrix from Quaternion. More...
 
BodyPosition const & q_refresh (bool const precise=true) const
 Refresh Quaternion from rotation matrix. More...
 

Private Attributes

Rotation R_
 Rotation matrix. More...
 
bool R_fresh_
 Rotation matrix status. More...
 
Quaternion q_
 Quaternion. More...
 
bool q_fresh_
 Quaternion status. More...
 
Translation t_
 Translation. More...
 

Friends

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

Detailed Description

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

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

Constructor & Destructor Documentation

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

Rotation + Translation constructor.

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

Rotation constructor.

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

Quaternion + Translation constructor.

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

Quaternion constructor.

template<typename >
numeric::BodyPosition< typename >::BodyPosition ( Point const &  ,
Vector const &  x1,
Vector const &  u1,
Point const &  ,
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(), numeric::xyzVector< typename >::is_normalized(), and test.T007_TracerIO::T.

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

Copy constructor.

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

Destructor.

Member Function Documentation

template<typename >
Value numeric::BodyPosition< typename >::angle ( ) const
inline
template<typename >
BodyPosition& numeric::BodyPosition< typename >::apply ( BodyPosition< typename > const &  p,
bool const  precise = true 
)
inline
template<typename >
Axis numeric::BodyPosition< typename >::axis ( ) const
inline
template<typename >
Axis& numeric::BodyPosition< typename >::axis ( Axis u) const
inline
template<typename >
static BodyPosition const& numeric::BodyPosition< typename >::I ( )
inlinestatic

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 >
static BodyPosition numeric::BodyPosition< typename >::identity ( )
inlinestatic

Identity named constructor.

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

template<typename >
BodyPosition numeric::BodyPosition< typename >::inverse ( ) const
inline
template<typename >
BodyPosition const& numeric::BodyPosition< typename >::inverse_transform ( Point p) const
inline
template<typename >
Point numeric::BodyPosition< typename >::inverse_transformed ( Point const &  p) const
inline
template<typename >
Translation numeric::BodyPosition< typename >::inverse_translation ( ) const
inline
template<typename >
BodyPosition& numeric::BodyPosition< typename >::invert ( )
inline
template<typename >
BodyPosition& numeric::BodyPosition< typename >::left_transform_by ( BodyPosition< typename > const &  p,
bool const  precise = true 
)
inline
template<typename >
BodyPosition& numeric::BodyPosition< typename >::left_transform_by_inverse_of ( BodyPosition< typename > const &  p,
bool const  precise = true 
)
inline
template<typename >
BodyPosition& numeric::BodyPosition< typename >::normalize ( )
inline
template<typename >
BodyPosition& numeric::BodyPosition< typename >::normalize_if_needed ( Value const &  tol = Traits::quaternion_tolerance())
inline
template<typename >
BodyPosition const& numeric::BodyPosition< typename >::operator() ( Point p) const
inline
template<typename >
BodyPosition& numeric::BodyPosition< typename >::operator= ( BodyPosition< typename > const &  bp)
inline
template<typename >
Quaternion const& numeric::BodyPosition< typename >::q ( ) const
inline
template<typename >
BodyPosition const& numeric::BodyPosition< typename >::q_refresh ( bool const  precise = true) const
inlineprivate
template<typename >
Rotation const& numeric::BodyPosition< typename >::R ( ) const
inline
template<typename >
BodyPosition const& numeric::BodyPosition< typename >::R_refresh ( bool const  precise = true) const
inlineprivate
template<typename >
BodyPosition& numeric::BodyPosition< typename >::right_transform_by ( BodyPosition< typename > const &  p,
bool const  precise = true 
)
inline
template<typename >
BodyPosition& numeric::BodyPosition< typename >::right_transform_by_inverse_of ( BodyPosition< typename > const &  p,
bool const  precise = true 
)
inline
template<typename >
Translation const& numeric::BodyPosition< typename >::t ( ) const
inline

Translation.

References numeric::BodyPosition< typename >::t_.

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

Friends And Related Function Documentation

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

Member Data Documentation

template<typename >
Quaternion numeric::BodyPosition< typename >::q_
mutableprivate
template<typename >
bool numeric::BodyPosition< typename >::q_fresh_
mutableprivate
template<typename >
Rotation numeric::BodyPosition< typename >::R_
mutableprivate
template<typename >
bool numeric::BodyPosition< typename >::R_fresh_
mutableprivate
template<typename >
Translation numeric::BodyPosition< typename >::t_
private

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