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
16namespace mrpt
17{
18 namespace opengl
19 {
20 // This must be added to any CSerializable derived class:
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 */
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
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
#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...
A planar disk in the XY plane.
Definition CDisk.h:35
uint32_t m_nLoops
Definition CDisk.h:40
CDisk(float rOut, float rIn, uint32_t slices, uint32_t loops)
Definition CDisk.h:70
float getInRadius() const
Definition CDisk.h:45
void setDiskRadius(float outRadius, float inRadius=0)
Definition CDisk.h:43
float getOutRadius() const
Definition CDisk.h:46
virtual ~CDisk()
Private, virtual destructor: only can be deleted from smart pointers.
Definition CDisk.h:73
void setSlicesCount(uint32_t N)
Default=50.
Definition CDisk.h:48
void setLoopsCount(uint32_t N)
Default=4.
Definition CDisk.h:49
void render_dl() const MRPT_OVERRIDE
Render.
A renderizable object suitable for rendering with OpenGL's display lists.
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated)
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
Definition mrpt_macros.h:28
struct OPENGL_IMPEXP CDiskPtr
Definition CDisk.h:21
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
unsigned long uint32_t
Definition pstdint.h:216



Page generated by Doxygen 1.9.8 for MRPT 1.4.0 SVN: at Fri Dec 15 05:36:48 UTC 2023