00001 #ifndef __MI_POSE_H
00002 #define __MI_POSE_H
00003
00004 #include <boost/shared_ptr.hpp>
00005 #include <boost/numeric/ublas/vector.hpp>
00006 #include <boost/numeric/ublas/matrix.hpp>
00007 #include <mimas/mm_object.h>
00008 #include <mimas/mm_xml_reference.h>
00009
00024 class mi_pose: public mimas::mm_object
00025 {
00026 public:
00028 typedef boost::numeric::ublas::matrix< double > Matrix;
00030 typedef boost::numeric::ublas::vector< double > Vector;
00034 mi_pose( const mimas::mm_xml_reference< XalanElement > &configuration );
00040 mi_pose( int dim = 3 ):
00041 rotation( boost::numeric::ublas::identity_matrix< double >( dim ) ),
00042 translation( dim ) {}
00053 mi_pose( const double w, const double t1, const double t2 );
00078 mi_pose( double yaw, double pitch, double roll,
00079 double t1, double t2, double t3 );
00083 mi_pose( const Matrix &_rotation, const Vector &_translation );
00086 mi_pose( const mi_pose &_pose ):
00087 rotation( _pose.rotation ), translation( _pose.translation ) {}
00095 mi_pose inv(void) const;
00103 Vector map( const Vector &x ) const
00104 { return prod( rotation, x ) + translation; }
00107 mi_pose operator*( const mi_pose &a ) const;
00110 const Matrix &getRotation(void) const { return rotation; }
00113 const Vector &getTranslation(void) const { return translation; }
00116 Matrix &getRotation(void) { return rotation; }
00119 Vector &getTranslation(void) { return translation; }
00123 static mi_pose scale_2d( double sx, double sy );
00128 static mi_pose scale_3d( double sx, double sy, double sz );
00132 static mi_pose translate_2d( double tx, double ty );
00137 static mi_pose translate_3d( double tx, double ty, double tz );
00140 static mi_pose rotate_2d( double w );
00141 protected:
00147 Matrix rotationBlock( int i1, int i2, int dim, double w );
00149 Matrix rotation;
00151 Vector translation;
00152 };
00153
00155 typedef boost::shared_ptr< mi_pose > mi_pose_ptr;
00156
00158
00159 #endif