sophus.cpp
Go to the documentation of this file.
00001 
00006 /*****************************************************************************
00007 ** Includes
00008 *****************************************************************************/
00009 
00010 #include <Eigen/Core>
00011 #include <sophus/se3.hpp>
00012 
00013 #include "../../include/qglv/converters/sophus_to_qgl.hpp"
00014 
00015 
00016 /*****************************************************************************
00017 ** Namespaces
00018 *****************************************************************************/
00019 
00020 namespace qglv {
00021 
00022 qglviewer::Frame sophusPose2QGLFrame(const Sophus::SE3f& pose) {
00023   return qglviewer::Frame(sophusPose2QGLTranslation(pose),
00024                           sophusPose2QGLOrientation(pose));
00025 }
00026 
00027 qglviewer::Vec sophusPose2QGLTranslation(const Sophus::SE3f& pose) {
00028   qglviewer::Vec translation(pose.translation().x(),
00029                              pose.translation().y(),
00030                              pose.translation().z()
00031                             );
00032   return translation;
00033 }
00034 
00035 
00036 qglviewer::Quaternion sophusPose2QGLOrientation(const Sophus::SE3f& pose) {
00037   Eigen::Vector3f axis_angle = pose.so3().log();
00038   double angle = axis_angle.norm();
00039   qglviewer::Vec axis(axis_angle[0],
00040                       axis_angle[1],
00041                       axis_angle[2]
00042                      );
00043   return qglviewer::Quaternion(axis, angle);
00044 }
00045 
00046 } // namespace qglv


qglv_extras
Author(s): Daniel Stonier
autogenerated on Sat Jun 18 2016 08:19:30