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://mrpt.sourceforge.net/                            |
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                   */
00054                 class OPENGL_IMPEXP CDisk : public CRenderizableDisplayList
00055                 {
00056                         DEFINE_SERIALIZABLE( CDisk )
00057 
00058                 protected:
00059                         float           m_radiusIn,m_radiusOut;
00060                         uint32_t        m_nSlices, m_nLoops;
00061 
00062                 public:
00063                         void setDiskRadius(float outRadius, float inRadius=0) { m_radiusIn=inRadius; m_radiusOut=outRadius; CRenderizableDisplayList::notifyChange(); }
00064 
00065                         float getInRadius() const { return m_radiusIn; }
00066                         float getOutRadius() const { return m_radiusOut; }
00067 
00068                         void setSlicesCount(uint32_t N) { m_nSlices=N; CRenderizableDisplayList::notifyChange(); }  //!< Default=50
00069                         void setLoopsCount(uint32_t N) { m_nLoops=N; CRenderizableDisplayList::notifyChange(); }  //!< Default=4
00070 
00071 
00072                         /** Render
00073                           */
00074                         void  render_dl() const;
00075 
00076                         /** Ray tracing
00077                           */
00078                         virtual bool traceRay(const mrpt::poses::CPose3D &o,double &dist) const;
00079 
00080                         static CDiskPtr Create(float radiusOut,float radiusIn,uint32_t slices=50,uint32_t loops=4)      {
00081                                 return CDiskPtr(new CDisk(radiusOut,radiusIn,slices,loops));
00082                         }
00083 
00084                 private:
00085                         /** Constructor
00086                           */
00087                         CDisk():m_radiusIn(0),m_radiusOut(1),m_nSlices(50),m_nLoops(4) {}
00088 
00089                         CDisk(float rOut,float rIn,uint32_t slices,uint32_t loops):m_radiusIn(rIn),m_radiusOut(rOut),m_nSlices(slices),m_nLoops(loops)  {}
00090 
00091                         /** Private, virtual destructor: only can be deleted from smart pointers */
00092                         virtual ~CDisk() { }
00093                 };
00094 
00095         } // end namespace
00096 
00097 } // End of namespace
00098 
00099 
00100 #endif



Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN: at Sat Mar 26 06:16:28 UTC 2011