reference_frames.cpp
Go to the documentation of this file.
00001 
00004 /*****************************************************************************
00005 ** Includes
00006 *****************************************************************************/
00007 
00008 #include <qglv/opengl.hpp>
00009 #include <QGLViewer/qglviewer.h>
00010 #include <sophus/se3.hpp>
00011 #include <string>
00012 #include "../../include/qglv/objects/reference_frames.hpp"
00013 
00014 /*****************************************************************************
00015 ** Namespaces
00016 *****************************************************************************/
00017 
00018 namespace qglv {
00019 //
00020 /*****************************************************************************
00021  ** Static Variables
00022  *****************************************************************************/
00023 
00024 const float ReferenceFrame::default_keyframe_size = 0.6;
00025 
00026 /*****************************************************************************
00027 ** Implementation
00028 *****************************************************************************/
00029 
00030 ReferenceFrame::ReferenceFrame(
00031          const std::string& name,
00032          const Sophus::SE3f& T,
00033          const Colour& colour,
00034          const Sophus::SE3f& parent
00035         )
00036 : name(name)
00037 , T_frame_rel_map(T)
00038 , colour(colour)
00039 , gl_id_start(-1)
00040 {
00041 }
00042 
00043 ReferenceFrame::~ReferenceFrame() {
00044   if ( gl_id_start > 0 ) {
00045     glDeleteLists(gl_id_start, 1);
00046   }
00047 }
00048 
00049 void ReferenceFrame::draw()
00050 {
00051   if (gl_id_start == -1) {
00052     _glGenLists();
00053   }
00054   GLfloat model[16];
00055   glPushMatrix();
00056   qglv::moveTo(T_frame_rel_map);
00057   glCallList(gl_id_start);
00058   glPopMatrix();
00059 }
00060 
00061 void ReferenceFrame::_glGenLists() {
00062   gl_id_start = ::glGenLists(1);
00063   glNewList( gl_id_start, GL_COMPILE );
00064   // pose
00065   QGLViewer::drawAxis(default_keyframe_size);
00066   qglv::moveTo(T_frame_rel_map.inverse());
00067   qglv::colour(colour);
00068   line(Eigen::Vector3f::Zero(), T_frame_rel_map.inverse().translation());
00069   // TODO : draw the text
00070   glEndList();
00071 }
00072 
00073 } // namespace qglv


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