MRPT  1.9.9
CDisk.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2019, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #pragma once
10 
11 #include <mrpt/math/geometry.h>
13 #include <mrpt/poses/CPose3D.h>
14 
15 namespace mrpt::opengl
16 {
17 /** A planar disk in the XY plane.
18  * \sa opengl::COpenGLScene
19  *
20  * <div align="center">
21  * <table border="0" cellspan="4" cellspacing="4" style="border-width: 1px;
22  * border-style: solid;">
23  * <tr> <td> mrpt::opengl::CDisk </td> <td> \image html preview_CDisk.png
24  * </td> </tr>
25  * </table>
26  * </div>
27  *
28  * \ingroup mrpt_opengl_grp
29  */
31 {
33 
34  protected:
35  float m_radiusIn{0}, m_radiusOut{1};
37 
38  public:
39  void setDiskRadius(float outRadius, float inRadius = 0)
40  {
41  m_radiusIn = inRadius;
42  m_radiusOut = outRadius;
44  }
45 
46  float getInRadius() const { return m_radiusIn; }
47  float getOutRadius() const { return m_radiusOut; }
48  /** Default=50 */
50  {
51  m_nSlices = N;
53  }
54  /** Default=4 */
56  {
57  m_nLoops = N;
59  }
60 
61  /** Render
62  */
63  void render_dl() const override;
64 
65  /** Evaluates the bounding box of this object (including possible children)
66  * in the coordinate frame of the object parent. */
67  void getBoundingBox(
69  mrpt::math::TPoint3D& bb_max) const override;
70 
71  /** Ray tracing
72  */
73  bool traceRay(const mrpt::poses::CPose3D& o, double& dist) const override;
74 
75  /** Constructor
76  */
77  CDisk() = default;
78  CDisk(float rOut, float rIn, uint32_t slices = 50, uint32_t loops = 4)
79  : m_radiusIn(rIn), m_radiusOut(rOut), m_nSlices(slices), m_nLoops(loops)
80  {
81  }
82 
83  /** Private, virtual destructor: only can be deleted from smart pointers */
84  ~CDisk() override = default;
85 };
86 
87 } // namespace mrpt::opengl
void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated) ...
void setDiskRadius(float outRadius, float inRadius=0)
Definition: CDisk.h:39
CDisk(float rOut, float rIn, uint32_t slices=50, uint32_t loops=4)
Definition: CDisk.h:78
void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const override
Evaluates the bounding box of this object (including possible children) in the coordinate frame of th...
Definition: CDisk.cpp:106
void render_dl() const override
Render.
Definition: CDisk.cpp:28
CDisk()=default
Constructor.
A renderizable object suitable for rendering with OpenGL&#39;s display lists.
void setSlicesCount(uint32_t N)
Default=50.
Definition: CDisk.h:49
A planar disk in the XY plane.
Definition: CDisk.h:30
#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:36
float m_radiusOut
Definition: CDisk.h:35
void setLoopsCount(uint32_t N)
Default=4.
Definition: CDisk.h:55
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:84
The namespace for 3D scene representation and rendering.
Definition: CGlCanvasBase.h:15
const auto bb_max
~CDisk() override=default
Private, virtual destructor: only can be deleted from smart pointers.
float getInRadius() const
Definition: CDisk.h:46
const auto bb_min
Lightweight 3D point.
Definition: TPoint3D.h:90
unsigned __int32 uint32_t
Definition: rptypes.h:50
float getOutRadius() const
Definition: CDisk.h:47
float m_radiusIn
Definition: CDisk.h:35
bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const override
Ray tracing.
Definition: CDisk.cpp:72
uint32_t m_nLoops
Definition: CDisk.h:36



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 8fe78517f Sun Jul 14 19:43:28 2019 +0200 at lun oct 28 02:10:00 CET 2019