MRPT  1.9.9
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-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 
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  protected:
33  mutable float m_x0, m_y0, m_z0;
34  mutable float m_x1, m_y1, m_z1;
35  float m_headRatio;
37  // For version 2 in stream
38  float m_arrow_roll;
40  float m_arrow_yaw;
41 
42  public:
44  float x0, float y0, float z0, float x1, float y1, float z1)
45  {
46  m_x0 = x0;
47  m_y0 = y0;
48  m_z0 = z0;
49  m_x1 = x1;
50  m_y1 = y1;
51  m_z1 = z1;
53  }
54  void setHeadRatio(float rat)
55  {
56  m_headRatio = rat;
58  }
59  void setSmallRadius(float rat)
60  {
61  m_smallRadius = rat;
63  }
64  void setLargeRadius(float rat)
65  {
66  m_largeRadius = rat;
68  }
69  void setArrowYawPitchRoll(float yaw, float pitch, float roll)
70  {
71  m_arrow_yaw = yaw;
75  }
76 
77  /** Render
78  */
79  void render_dl() const override;
80 
81  /** Evaluates the bounding box of this object (including possible children)
82  * in the coordinate frame of the object parent. */
83  void getBoundingBox(
85  mrpt::math::TPoint3D& bb_max) const override;
86 
87  /** Constructor
88  */
90  float x0 = 0, float y0 = 0, float z0 = 0, float x1 = 1, float y1 = 1,
91  float z1 = 1, float headRatio = 0.2f, float smallRadius = 0.05f,
92  float largeRadius = 0.2f, float arrow_roll = -1.0f,
93  float arrow_pitch = -1.0f, float arrow_yaw = -1.0f)
94  : m_x0(x0),
95  m_y0(y0),
96  m_z0(z0),
97  m_x1(x1),
98  m_y1(y1),
99  m_z1(z1),
100  m_headRatio(headRatio),
101  m_smallRadius(smallRadius),
102  m_largeRadius(largeRadius),
103  m_arrow_roll(arrow_roll),
104  m_arrow_pitch(arrow_pitch),
105  m_arrow_yaw(arrow_yaw)
106  {
107  }
108 
109  /** Private, virtual destructor: only can be deleted from smart pointers */
110  ~CArrow() override = default;
111 };
112 
113 } // namespace mrpt::opengl
void setArrowEnds(float x0, float y0, float z0, float x1, float y1, float z1)
Definition: CArrow.h:43
void setLargeRadius(float rat)
Definition: CArrow.h:64
void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated) ...
void render_dl() const override
Render.
Definition: CArrow.cpp:30
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:238
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, float arrow_roll=-1.0f, float arrow_pitch=-1.0f, float arrow_yaw=-1.0f)
Constructor.
Definition: CArrow.h:89
#define DEFINE_SCHEMA_SERIALIZABLE()
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
float m_arrow_pitch
Definition: CArrow.h:39
A renderizable object suitable for rendering with OpenGL&#39;s display lists.
float m_arrow_roll
Definition: CArrow.h:38
~CArrow() override=default
Private, virtual destructor: only can be deleted from smart pointers.
void setSmallRadius(float rat)
Definition: CArrow.h:59
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
void setArrowYawPitchRoll(float yaw, float pitch, float roll)
Definition: CArrow.h:69
The namespace for 3D scene representation and rendering.
Definition: CGlCanvasBase.h:15
const auto bb_max
float m_largeRadius
Definition: CArrow.h:36
void setHeadRatio(float rat)
Definition: CArrow.h:54
A 3D arrow.
Definition: CArrow.h:28
const auto bb_min
Lightweight 3D point.
Definition: TPoint3D.h:90
float m_smallRadius
Definition: CArrow.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