Main MRPT website > C++ reference
MRPT logo
CDisk.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-2011  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_CDisk_H
00029 #define opengl_CDisk_H
00030 
00031 #include <mrpt/opengl/CRenderizableDisplayList.h>
00032 #include <mrpt/poses/CPose3D.h>
00033 #include <mrpt/math/geometry.h>
00034 
00035 namespace mrpt
00036 {
00037         namespace opengl
00038         {
00039                 class OPENGL_IMPEXP CDisk;
00040 
00041                 // This must be added to any CSerializable derived class:
00042                 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE( CDisk, CRenderizableDisplayList, OPENGL_IMPEXP )
00043 
00044                 /** A planar disk in the XY plane.
00045                   *  \sa opengl::COpenGLScene
00046                   *  
00047                   *  <div align="center">
00048                   *  <table border="0" cellspan="4" cellspacing="4" style="border-width: 1px; border-style: solid;">
00049                   *   <tr> <td> mrpt::opengl::CDisk </td> <td> \image html preview_CDisk.png </td> </tr>
00050                   *  </table>
00051                   *  </div>
00052                   *  
00053                   * \ingroup mrpt_opengl_grp
00054                   */
00055                 class OPENGL_IMPEXP CDisk : public CRenderizableDisplayList
00056                 {
00057                         DEFINE_SERIALIZABLE( CDisk )
00058 
00059                 protected:
00060                         float           m_radiusIn,m_radiusOut;
00061                         uint32_t        m_nSlices, m_nLoops;
00062 
00063                 public:
00064                         void setDiskRadius(float outRadius, float inRadius=0) { m_radiusIn=inRadius; m_radiusOut=outRadius; CRenderizableDisplayList::notifyChange(); }
00065 
00066                         float getInRadius() const { return m_radiusIn; }
00067                         float getOutRadius() const { return m_radiusOut; }
00068 
00069                         void setSlicesCount(uint32_t N) { m_nSlices=N; CRenderizableDisplayList::notifyChange(); }  //!< Default=50
00070                         void setLoopsCount(uint32_t N) { m_nLoops=N; CRenderizableDisplayList::notifyChange(); }  //!< Default=4
00071 
00072 
00073                         /** Render
00074                           */
00075                         void  render_dl() const;
00076 
00077                         /** Ray tracing
00078                           */
00079                         virtual bool traceRay(const mrpt::poses::CPose3D &o,double &dist) const;
00080 
00081                         static CDiskPtr Create(float radiusOut,float radiusIn,uint32_t slices=50,uint32_t loops=4)      {
00082                                 return CDiskPtr(new CDisk(radiusOut,radiusIn,slices,loops));
00083                         }
00084 
00085                 private:
00086                         /** Constructor
00087                           */
00088                         CDisk():m_radiusIn(0),m_radiusOut(1),m_nSlices(50),m_nLoops(4) {}
00089 
00090                         CDisk(float rOut,float rIn,uint32_t slices,uint32_t loops):m_radiusIn(rIn),m_radiusOut(rOut),m_nSlices(slices),m_nLoops(loops)  {}
00091 
00092                         /** Private, virtual destructor: only can be deleted from smart pointers */
00093                         virtual ~CDisk() { }
00094                 };
00095 
00096         } // end namespace
00097 
00098 } // End of namespace
00099 
00100 
00101 #endif



Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011