Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
trv_rotations.hpp
00001 #ifndef TRV_ROTATIONS_HPP
00002 #define TRV_ROTATIONS_HPP
00003 
00004 #include "kernel/jafarException.hpp"
00005 #include "jmath/jblas.hpp"
00006 #include "jmath/ublasExtra.hpp"
00007 
00008 // #include <boost/numeric/ublas/matrix.hpp>
00009 // #include <boost/numeric/ublas/io.hpp>
00010 // #include "boost/numeric/ublas/matrix_proxy.hpp"
00011 // #include "boost/numeric/ublas/operation.hpp"
00012 // #include <boost/numeric/bindings/lapack/gesdd.hpp>
00013 
00014 const double TRV_TOLERANCE = 0.001;
00015 const double TRV_ZERO_TOLERANCE = 1e-10;
00016 const std::string TRV_EULER_CONFIG = "zyx";
00017 
00018 namespace jafar {
00019   namespace traversability {
00020     
00021     // conversions between the rotation representations
00022     jblas::vec4  mat2quat   ( const jblas::mat33 &R );  //imp
00023     jblas::mat33 quat2mat   ( const jblas::vec4 &q );   //imp
00024     jblas::vec4  euler2quat ( double psi, double theta, double phi, std::string config = TRV_EULER_CONFIG );  // imp
00025     jblas::vec4  euler2quat ( const jblas::vec3 &eulers, std::string config = TRV_EULER_CONFIG ); // imp
00026     jblas::mat33 euler2mat  ( double psi, double theta, double phi, std::string config = TRV_EULER_CONFIG ); // imp
00027     jblas::mat33 euler2mat  ( const jblas::vec3 &eulers, std::string config = TRV_EULER_CONFIG ); // imp
00028     jblas::vec4  axis2quat  ( const jblas::vec3 &axis, double phi );  // imp
00029     jblas::mat33 axis2mat   ( const jblas::vec3 &axis, double phi ); // imp
00030     // two output arguments therefore void
00031     void         quat2axis  ( const jblas::vec4 &q, jblas::vec3 &axis, double &phi ); 
00032     
00033     // internal utility functions (for euler related stuff)
00034     jblas::vec4 basicRotQuat( double angle, char rotAx );
00035     jblas::mat33 basicRotMat( double angle, char rotAx );
00036     inline double signof(double a) { return (a == 0) ? 0 : (a<0 ? -1 : 1); }
00037     //inline int signof(int a) { return (a == 0) ? 0 : (a<0 ? -1 : 1); }
00038     
00039     
00040     // quaternion related functions
00041     jblas::vec4 quatRotScale ( const jblas::vec4 &q, double b );
00042     jblas::vec4 quatMul ( const jblas::vec4 &q1, const jblas::vec4 &q2 );
00043     jblas::vec4 quatCon ( const jblas::vec4 &q );
00044     jblas::vec4 quatInv ( const jblas::vec4 &q );
00045     
00046     // check utilities
00047     // This utilities can be excluded from the final code since, if everything works
00048     // well, a set of euler angles always can be transformed to a rotation matrix, and 
00049     // a rotation matrix always can be translated into quaternions.
00050     // Thus, the functions above help to find out if the above really is the case...
00051     void isrotquat ( const jblas::vec4 &q );
00052     void isrotmat ( const jblas::mat33 &R );
00053     void issp3 ( const jblas::mat33 &R );   // is special orthogonal 3d?
00054 
00055   } // end namespace traversability
00056 } // end namespace traversability
00057 #endif
00058 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Wed Oct 15 2014 00:37:29 for Jafar by doxygen 1.7.6.1
LAAS-CNRS