CMyEllipsoid.h
Go to the documentation of this file.
00001 /* +---------------------------------------------------------------------------+
00002    |          The Mobile Robot Programming Toolkit (MRPT) C++ library          |
00003    |                                                                           |
00004    |                       http://www.mrpt.org/                                |
00005    |                                                                           |
00006    |   Copyright (C) 2005-2012  University of Malaga                           |
00007    |                                                                           |
00008    |    This software was written by the Machine Perception and Intelligent    |
00009    |      Robotics Lab, University of Malaga (Spain).                          |
00010    |    Contact: Jose-Luis Blanco  <jlblanco@ctima.uma.es>                     |
00011    |                                                                           |
00012    |  This file is part of the MRPT project.                                   |
00013    |                                                                           |
00014    |     MRPT is free software: you can redistribute it and/or modify          |
00015    |     it under the terms of the GNU General Public License as published by  |
00016    |     the Free Software Foundation, either version 3 of the License, or     |
00017    |     (at your option) any later version.                                   |
00018    |                                                                           |
00019    |   MRPT is distributed in the hope that it will be useful,                 |
00020    |     but WITHOUT ANY WARRANTY; without even the implied warranty of        |
00021    |     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         |
00022    |     GNU General Public License for more details.                          |
00023    |                                                                           |
00024    |     You should have received a copy of the GNU General Public License     |
00025    |     along with MRPT.  If not, see <http://www.gnu.org/licenses/>.         |
00026    |                                                                           |
00027    +---------------------------------------------------------------------------+ */
00028 #ifndef opengl_CMyEllipsoid_H
00029 #define opengl_CMyEllipsoid_H
00030 
00031 #include <mrpt/opengl/CRenderizableDisplayList.h>
00032 #include <mrpt/math/CMatrixD.h>
00033 #include <mrpt/math/CMatrixFixedNumeric.h>
00034 
00035 namespace mrpt
00036 {
00037         namespace opengl
00038         {
00039                 class OPENGL_IMPEXP CMyEllipsoid;
00040 
00041                 // This must be added to any CSerializable derived class:
00042                 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE( CMyEllipsoid, CRenderizableDisplayList, OPENGL_IMPEXP )
00043 
00044                 
00064                 class OPENGL_IMPEXP CMyEllipsoid : public CRenderizableDisplayList
00065                 {
00066                         DEFINE_SERIALIZABLE( CMyEllipsoid )
00067 
00068                 protected:
00071                         math::CMatrixD          m_eigVal,m_eigVec,m_prevComputedCov;
00072 
00073                         math::CMatrixD  m_cov;          
00074                         bool                    m_drawSolid3D;  
00075                         float                   m_quantiles;    
00076                         unsigned int    m_2D_segments;  
00077                         unsigned int    m_3D_segments;  
00078                         float                   m_lineWidth;    
00079 
00080                 public:
00081                         void setCovMatrix( const mrpt::math::CMatrixDouble &m, int resizeToSize = -1 ); 
00082                         void setCovMatrix( const mrpt::math::CMatrixFloat &m, int resizeToSize = -1 ); 
00083 
00086                         template <typename T>
00087                         void setCovMatrix( const mrpt::math::CMatrixFixedNumeric<T,3,3> &m, int resizeToSize = -1 )     {
00088                                 setCovMatrix(mrpt::math::CMatrixTemplateNumeric<T>(m),resizeToSize);
00089                         }
00090 
00093                         template <typename T>
00094                         void setCovMatrix( const mrpt::math::CMatrixFixedNumeric<T,2,2> &m )    {
00095                                 setCovMatrix(mrpt::math::CMatrixTemplateNumeric<T>(m));
00096                         }
00097 
00098                         mrpt::math::CMatrixDouble getCovMatrix() const { return mrpt::math::CMatrixDouble(m_cov); }
00099 
00100                         void enableDrawSolid3D(bool v) { m_drawSolid3D = v; CRenderizableDisplayList::notifyChange(); } 
00101                         void setQuantiles(float q) { m_quantiles=q; CRenderizableDisplayList::notifyChange(); } 
00102                         float getQuantiles() const { return m_quantiles; }
00103 
00104                         void set2DsegmentsCount(unsigned int N) { m_2D_segments=N; CRenderizableDisplayList::notifyChange(); }  
00105                         void set3DsegmentsCount(unsigned int N) { m_3D_segments=N; CRenderizableDisplayList::notifyChange(); } 
00106 
00107                         void setLineWidth(float w) { m_lineWidth=w; CRenderizableDisplayList::notifyChange(); } 
00108                         float getLineWidth() const { return m_lineWidth; }
00109 
00110 
00115                         void  render_dl() const;
00118                         virtual bool traceRay(const mrpt::poses::CPose3D &o,double &dist) const;
00119                         virtual void getBoundingBox(mrpt::math::TPoint3D&, mrpt::math::TPoint3D&) const{}
00120                         CObject* duplicate(){return this;}
00121                 private:
00124                         CMyEllipsoid() : m_eigVal(),m_eigVec(),m_prevComputedCov(),
00125                                 m_cov(2,2),
00126                                 m_drawSolid3D(true),
00127                                 m_quantiles(3),
00128                                 m_2D_segments(20),
00129                                 m_3D_segments(20),
00130                                 m_lineWidth(1.0)
00131                         {
00132                         }
00134                         virtual ~CMyEllipsoid() { }
00135                 };
00136 
00137         } // end namespace
00138 
00139 } // End of namespace
00140 
00141 
00142 #endif


ndt_visualisation
Author(s): Todor Stoyanov, Jari Saarinen, Henrik Andreasson
autogenerated on Mon Oct 6 2014 03:19:48