Main MRPT website > C++ reference
MRPT logo
CDisk.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | The Mobile Robot Programming Toolkit (MRPT) C++ library |
3  | |
4  | http://www.mrpt.org/ |
5  | |
6  | Copyright (C) 2005-2012 University of Malaga |
7  | |
8  | This software was written by the Machine Perception and Intelligent |
9  | Robotics Lab, University of Malaga (Spain). |
10  | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> |
11  | |
12  | This file is part of the MRPT project. |
13  | |
14  | MRPT is free software: you can redistribute it and/or modify |
15  | it under the terms of the GNU General Public License as published by |
16  | the Free Software Foundation, either version 3 of the License, or |
17  | (at your option) any later version. |
18  | |
19  | MRPT is distributed in the hope that it will be useful, |
20  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
21  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22  | GNU General Public License for more details. |
23  | |
24  | You should have received a copy of the GNU General Public License |
25  | along with MRPT. If not, see <http://www.gnu.org/licenses/>. |
26  | |
27  +---------------------------------------------------------------------------+ */
28 #ifndef opengl_CDisk_H
29 #define opengl_CDisk_H
30 
32 #include <mrpt/poses/CPose3D.h>
33 #include <mrpt/math/geometry.h>
34 
35 namespace mrpt
36 {
37  namespace opengl
38  {
40 
41  // This must be added to any CSerializable derived class:
43 
44  /** A planar disk in the XY plane.
45  * \sa opengl::COpenGLScene
46  *
47  * <div align="center">
48  * <table border="0" cellspan="4" cellspacing="4" style="border-width: 1px; border-style: solid;">
49  * <tr> <td> mrpt::opengl::CDisk </td> <td> \image html preview_CDisk.png </td> </tr>
50  * </table>
51  * </div>
52  *
53  * \ingroup mrpt_opengl_grp
54  */
56  {
58 
59  protected:
60  float m_radiusIn,m_radiusOut;
61  uint32_t m_nSlices, m_nLoops;
62 
63  public:
64  void setDiskRadius(float outRadius, float inRadius=0) { m_radiusIn=inRadius; m_radiusOut=outRadius; CRenderizableDisplayList::notifyChange(); }
65 
66  float getInRadius() const { return m_radiusIn; }
67  float getOutRadius() const { return m_radiusOut; }
68 
69  void setSlicesCount(uint32_t N) { m_nSlices=N; CRenderizableDisplayList::notifyChange(); } //!< Default=50
70  void setLoopsCount(uint32_t N) { m_nLoops=N; CRenderizableDisplayList::notifyChange(); } //!< Default=4
71 
72 
73  /** Render
74  */
75  void render_dl() const;
76 
77  /** Ray tracing
78  */
79  virtual bool traceRay(const mrpt::poses::CPose3D &o,double &dist) const;
80 
81  static CDiskPtr Create(float radiusOut,float radiusIn,uint32_t slices=50,uint32_t loops=4) {
82  return CDiskPtr(new CDisk(radiusOut,radiusIn,slices,loops));
83  }
84 
85  private:
86  /** Constructor
87  */
88  CDisk():m_radiusIn(0),m_radiusOut(1),m_nSlices(50),m_nLoops(4) {}
89 
90  CDisk(float rOut,float rIn,uint32_t slices,uint32_t loops):m_radiusIn(rIn),m_radiusOut(rOut),m_nSlices(slices),m_nLoops(loops) {}
91 
92  /** Private, virtual destructor: only can be deleted from smart pointers */
93  virtual ~CDisk() { }
94  };
95 
96  } // end namespace
97 
98 } // End of namespace
99 
100 
101 #endif



Page generated by Doxygen 1.8.3 for MRPT 0.9.6 SVN: at Fri Feb 15 22:05:02 EST 2013