Main MRPT website > C++ reference for MRPT 1.4.0
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-2016, 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
geometry.h
mrpt::opengl::CDisk::setDiskRadius
void setDiskRadius(float outRadius, float inRadius=0)
Definition: CDisk.h:43
CRenderizableDisplayList.h
mrpt::opengl::CDisk::m_nSlices
uint32_t m_nSlices
Definition: CDisk.h:40
mrpt::opengl::CRenderizableDisplayList
A renderizable object suitable for rendering with OpenGL's display lists.
Definition: CRenderizableDisplayList.h:36
mrpt::opengl::CRenderizableDisplayList::notifyChange
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated)
Definition: CRenderizableDisplayList.h:49
mrpt::opengl::CDisk::CDisk
CDisk(float rOut, float rIn, uint32_t slices, uint32_t loops)
Definition: CDisk.h:70
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CParticleFilter.h:16
mrpt::opengl::CDisk::m_radiusOut
float m_radiusOut
Definition: CDisk.h:39
DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
Definition: CSerializable.h:174
mrpt::opengl::CDisk
A planar disk in the XY plane.
Definition: CDisk.h:34
mrpt::opengl::CDisk::~CDisk
virtual ~CDisk()
Private, virtual destructor: only can be deleted from smart pointers.
Definition: CDisk.h:73
CPose3D.h
DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE
#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...
Definition: CSerializable.h:170
mrpt::opengl::CDisk::getInRadius
float getInRadius() const
Definition: CDisk.h:45
DEFINE_SERIALIZABLE
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
Definition: CSerializable.h:147
mrpt::math::traceRay
bool BASE_IMPEXP traceRay(const vector< TPolygonWithPlane > &vec, const mrpt::poses::CPose3D &pose, double &dist)
Fast ray tracing method using polygons' properties.
mrpt::opengl::CDisk::getOutRadius
float getOutRadius() const
Definition: CDisk.h:46
MRPT_OVERRIDE
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
Definition: mrpt_macros.h:28



Page generated by Doxygen 1.8.17 for MRPT 1.4.0 SVN: at Tue Mar 3 09:15:16 UTC 2020