MRPT  1.9.9
CArrow.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-2018, 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_CArrow_H
10 #define opengl_CArrow_H
11 
13 
14 namespace mrpt::opengl
15 {
16 /** A 3D arrow
17  * \sa opengl::COpenGLScene
18  *
19  * <div align="center">
20  * <table border="0" cellspan="4" cellspacing="4" style="border-width: 1px;
21  * border-style: solid;">
22  * <tr> <td> mrpt::opengl::CArrow </td> <td> \image html preview_CArrow.png
23  * </td> </tr>
24  * </table>
25  * </div>
26  * \ingroup mrpt_opengl_grp
27  *
28  */
30 {
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(
84  mrpt::math::TPoint3D& bb_min,
85  mrpt::math::TPoint3D& bb_max) const override;
86 
87  /** Class factory */
88  static CArrow::Ptr Create(
89  float x0, float y0, float z0, float x1, float y1, float z1,
90  float headRatio = 0.2f, float smallRadius = 0.05f,
91  float largeRadius = 0.2f, float arrow_roll = -1.0f,
92  float arrow_pitch = -1.0f, float arrow_yaw = -1.0f);
93 
94  /** Constructor
95  */
97  float x0 = 0, float y0 = 0, float z0 = 0, float x1 = 1, float y1 = 1,
98  float z1 = 1, float headRatio = 0.2f, float smallRadius = 0.05f,
99  float largeRadius = 0.2f, float arrow_roll = -1.0f,
100  float arrow_pitch = -1.0f, float arrow_yaw = -1.0f)
101  : m_x0(x0),
102  m_y0(y0),
103  m_z0(z0),
104  m_x1(x1),
105  m_y1(y1),
106  m_z1(z1),
107  m_headRatio(headRatio),
108  m_smallRadius(smallRadius),
109  m_largeRadius(largeRadius),
110  m_arrow_roll(arrow_roll),
111  m_arrow_pitch(arrow_pitch),
112  m_arrow_yaw(arrow_yaw)
113  {
114  }
115 
116  /** Private, virtual destructor: only can be deleted from smart pointers */
117  virtual ~CArrow() {}
118 };
119 
120 }
121 #endif
122 
123 
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 render_dl() const override
Render.
Definition: CArrow.cpp:41
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:212
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:96
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated) ...
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
void setSmallRadius(float rat)
Definition: CArrow.h:59
virtual ~CArrow()
Private, virtual destructor: only can be deleted from smart pointers.
Definition: CArrow.h:117
static Ptr Create(Args &&... args)
Definition: CArrow.h:31
#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
float m_largeRadius
Definition: CArrow.h:36
void setHeadRatio(float rat)
Definition: CArrow.h:54
A 3D arrow.
Definition: CArrow.h:29
Lightweight 3D point.
float m_smallRadius
Definition: CArrow.h:36



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020