MRPT  2.0.2
CArrow.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 
12 
13 namespace mrpt::opengl
14 {
15 /** A 3D arrow
16  * \sa opengl::COpenGLScene
17  *
18  * <div align="center">
19  * <table border="0" cellspan="4" cellspacing="4" style="border-width: 1px;
20  * border-style: solid;">
21  * <tr> <td> mrpt::opengl::CArrow </td> <td> \image html preview_CArrow.png
22  * </td> </tr>
23  * </table>
24  * </div>
25  * \ingroup mrpt_opengl_grp
26  *
27  */
29 {
32 
33  public:
34  /** @name Renderizable shader API virtual methods
35  * @{ */
36  void onUpdateBuffers_Triangles() override;
37  /** @} */
38 
40  float x0, float y0, float z0, float x1, float y1, float z1)
41  {
42  m_x0 = x0;
43  m_y0 = y0;
44  m_z0 = z0;
45  m_x1 = x1;
46  m_y1 = y1;
47  m_z1 = z1;
49  }
50  void setHeadRatio(float rat)
51  {
52  m_headRatio = rat;
54  }
55  void setSmallRadius(float rat)
56  {
57  m_smallRadius = rat;
59  }
60  void setLargeRadius(float rat)
61  {
62  m_largeRadius = rat;
64  }
65  /** Number of radial divisions */
66  inline void setSlicesCount(uint32_t slices)
67  {
68  m_slices = slices;
70  }
71 
72  /** Number of radial divisions */
73  inline uint32_t getSlicesCount() const { return m_slices; }
74 
75  void getBoundingBox(
77  mrpt::math::TPoint3D& bb_max) const override;
78 
79  /** Constructor */
81  float x0 = 0, float y0 = 0, float z0 = 0, float x1 = 1, float y1 = 1,
82  float z1 = 1, float headRatio = 0.2f, float smallRadius = 0.05f,
83  float largeRadius = 0.2f)
84  : m_x0(x0),
85  m_y0(y0),
86  m_z0(z0),
87  m_x1(x1),
88  m_y1(y1),
89  m_z1(z1),
90  m_headRatio(headRatio),
91  m_smallRadius(smallRadius),
92  m_largeRadius(largeRadius)
93  {
94  }
95 
96  ~CArrow() override = default;
97 
98  protected:
99  mutable float m_x0, m_y0, m_z0;
100  mutable float m_x1, m_y1, m_z1;
101  float m_headRatio;
103  /** Number of radial divisions. */
104  uint32_t m_slices = 10;
105 };
106 
107 } // namespace mrpt::opengl
void setArrowEnds(float x0, float y0, float z0, float x1, float y1, float z1)
Definition: CArrow.h:39
void setLargeRadius(float rat)
Definition: CArrow.h:60
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: CArrow.cpp:198
void notifyChange() const
Call to enable calling renderUpdateBuffers() before the next render() rendering iteration.
Renderizable generic renderer for objects using the triangles shader.
#define DEFINE_SCHEMA_SERIALIZABLE()
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
uint32_t m_slices
Number of radial divisions.
Definition: CArrow.h:104
~CArrow() override=default
void setSmallRadius(float rat)
Definition: CArrow.h:55
CArrow(float x0=0, float y0=0, float z0=0, float x1=1, float y1=1, float z1=1, float headRatio=0.2f, float smallRadius=0.05f, float largeRadius=0.2f)
Constructor.
Definition: CArrow.h:80
uint32_t getSlicesCount() const
Number of radial divisions.
Definition: CArrow.h:73
void onUpdateBuffers_Triangles() override
Must be implemented in derived classes to update the geometric entities to be drawn in "m_*_buffer" f...
Definition: CArrow.cpp:26
The namespace for 3D scene representation and rendering.
Definition: CGlCanvasBase.h:13
const auto bb_max
void setHeadRatio(float rat)
Definition: CArrow.h:50
A 3D arrow.
Definition: CArrow.h:28
#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 setSlicesCount(uint32_t slices)
Number of radial divisions.
Definition: CArrow.h:66



Page generated by Doxygen 1.8.14 for MRPT 2.0.2 Git: 9b4fd2465 Mon May 4 16:59:08 2020 +0200 at lun may 4 17:26:07 CEST 2020