Main MRPT website > C++ reference for MRPT 1.5.6
CDisk.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 #ifndef opengl_CDisk_H
10 #define opengl_CDisk_H
11 
13 #include <mrpt/poses/CPose3D.h>
14 #include <mrpt/math/geometry.h>
15 
16 namespace mrpt
17 {
18  namespace opengl
19  {
20  // This must be added to any CSerializable derived class:
21  DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE( CDisk, CRenderizableDisplayList, OPENGL_IMPEXP )
22 
23  /** A planar disk in the XY plane.
24  * \sa opengl::COpenGLScene
25  *
26  * <div align="center">
27  * <table border="0" cellspan="4" cellspacing="4" style="border-width: 1px; border-style: solid;">
28  * <tr> <td> mrpt::opengl::CDisk </td> <td> \image html preview_CDisk.png </td> </tr>
29  * </table>
30  * </div>
31  *
32  * \ingroup mrpt_opengl_grp
33  */
35  {
37 
38  protected:
39  float m_radiusIn,m_radiusOut;
40  uint32_t m_nSlices, m_nLoops;
41 
42  public:
43  void setDiskRadius(float outRadius, float inRadius=0) { m_radiusIn=inRadius; m_radiusOut=outRadius; CRenderizableDisplayList::notifyChange(); }
44 
45  float getInRadius() const { return m_radiusIn; }
46  float getOutRadius() const { return m_radiusOut; }
47 
48  void setSlicesCount(uint32_t N) { m_nSlices=N; CRenderizableDisplayList::notifyChange(); } //!< Default=50
49  void setLoopsCount(uint32_t N) { m_nLoops=N; CRenderizableDisplayList::notifyChange(); } //!< Default=4
50 
51 
52  /** Render
53  */
54  void render_dl() const MRPT_OVERRIDE;
55 
56  /** Evaluates the bounding box of this object (including possible children) in the coordinate frame of the object parent. */
57  void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const MRPT_OVERRIDE;
58 
59  /** Ray tracing
60  */
61  bool traceRay(const mrpt::poses::CPose3D &o,double &dist) const MRPT_OVERRIDE;
62 
63  static CDiskPtr Create(float radiusOut,float radiusIn,uint32_t slices=50,uint32_t loops=4);
64 
65  private:
66  /** Constructor
67  */
68  CDisk():m_radiusIn(0),m_radiusOut(1),m_nSlices(50),m_nLoops(4) {}
69 
70  CDisk(float rOut,float rIn,uint32_t slices,uint32_t loops):m_radiusIn(rIn),m_radiusOut(rOut),m_nSlices(slices),m_nLoops(loops) {}
71 
72  /** Private, virtual destructor: only can be deleted from smart pointers */
73  virtual ~CDisk() { }
74  };
75  DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE( CDisk, CRenderizableDisplayList, OPENGL_IMPEXP )
76 
77  } // end namespace
78 
79 } // End of namespace
80 
81 
82 #endif
virtual ~CDisk()
Private, virtual destructor: only can be deleted from smart pointers.
Definition: CDisk.h:73
void setDiskRadius(float outRadius, float inRadius=0)
Definition: CDisk.h:43
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
bool BASE_IMPEXP traceRay(const std::vector< TPolygonWithPlane > &vec, const mrpt::poses::CPose3D &pose, double &dist)
Fast ray tracing method using polygons&#39; properties.
Definition: geometry.cpp:1996
CDisk(float rOut, float rIn, uint32_t slices, uint32_t loops)
Definition: CDisk.h:70
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated) ...
A renderizable object suitable for rendering with OpenGL&#39;s display lists.
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
void setSlicesCount(uint32_t N)
Default=50.
Definition: CDisk.h:48
A planar disk in the XY plane.
Definition: CDisk.h:34
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
uint32_t m_nSlices
Definition: CDisk.h:40
float m_radiusOut
Definition: CDisk.h:39
void setLoopsCount(uint32_t N)
Default=4.
Definition: CDisk.h:49
float getInRadius() const
Definition: CDisk.h:45
unsigned __int32 uint32_t
Definition: rptypes.h:49
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
float getOutRadius() const
Definition: CDisk.h:46



Page generated by Doxygen 1.8.14 for MRPT 1.5.6 Git: 4c65e8431 Tue Apr 24 08:18:17 2018 +0200 at lun oct 28 01:35:26 CET 2019