MRPT  2.0.4
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-2020, 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  public:
35  /** @name Renderizable shader API virtual methods
36  * @{ */
37  void onUpdateBuffers_Triangles() override;
38  /** @} */
39 
40  void setDiskRadius(float outRadius, float inRadius = 0)
41  {
42  m_radiusIn = inRadius;
43  m_radiusOut = outRadius;
45  }
46 
47  float getInRadius() const { return m_radiusIn; }
48  float getOutRadius() const { return m_radiusOut; }
49 
50  /** Default=50 */
51  void setSlicesCount(uint32_t N)
52  {
53  m_nSlices = N;
55  }
56 
57  /** Evaluates the bounding box of this object (including possible children)
58  * in the coordinate frame of the object parent. */
59  void getBoundingBox(
61  mrpt::math::TPoint3D& bb_max) const override;
62 
63  /** Ray tracing
64  */
65  bool traceRay(const mrpt::poses::CPose3D& o, double& dist) const override;
66 
67  /** Constructor
68  */
69  CDisk() = default;
70  CDisk(float rOut, float rIn, uint32_t slices = 50)
71  : m_radiusIn(rIn), m_radiusOut(rOut), m_nSlices(slices)
72  {
73  }
74 
75  /** Private, virtual destructor: only can be deleted from smart pointers */
76  ~CDisk() override = default;
77 
78  protected:
79  float m_radiusIn = 0, m_radiusOut = 1;
80  uint32_t m_nSlices = 50;
81 };
82 
83 } // namespace mrpt::opengl
void setDiskRadius(float outRadius, float inRadius=0)
Definition: CDisk.h:40
void notifyChange() const
Call to enable calling renderUpdateBuffers() before the next render() rendering iteration.
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:143
Renderizable generic renderer for objects using the triangles shader.
CDisk()=default
Constructor.
void setSlicesCount(uint32_t N)
Default=50.
Definition: CDisk.h:51
A planar disk in the XY plane.
Definition: CDisk.h:30
uint32_t m_nSlices
Definition: CDisk.h:80
CDisk(float rOut, float rIn, uint32_t slices=50)
Definition: CDisk.h:70
float m_radiusOut
Definition: CDisk.h:79
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:85
The namespace for 3D scene representation and rendering.
Definition: CGlCanvasBase.h:13
const auto bb_max
~CDisk() override=default
Private, virtual destructor: only can be deleted from smart pointers.
float getInRadius() const
Definition: CDisk.h:47
#define DEFINE_SERIALIZABLE(class_name, NS)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
const auto bb_min
void onUpdateBuffers_Triangles() override
Must be implemented in derived classes to update the geometric entities to be drawn in "m_*_buffer" f...
Definition: CDisk.cpp:22
float getOutRadius() const
Definition: CDisk.h:48
float m_radiusIn
Definition: CDisk.h:79
bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const override
Ray tracing.
Definition: CDisk.cpp:109



Page generated by Doxygen 1.8.14 for MRPT 2.0.4 Git: 33de1d0ad Sat Jun 20 11:02:42 2020 +0200 at sáb jun 20 17:35:17 CEST 2020