Main MRPT website > C++ reference for 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-2017, 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
15 {
16 namespace opengl
17 {
18 /** A 3D arrow
19  * \sa opengl::COpenGLScene
20  *
21  * <div align="center">
22  * <table border="0" cellspan="4" cellspacing="4" style="border-width: 1px;
23  * border-style: solid;">
24  * <tr> <td> mrpt::opengl::CArrow </td> <td> \image html preview_CArrow.png
25  * </td> </tr>
26  * </table>
27  * </div>
28  * \ingroup mrpt_opengl_grp
29  *
30  */
32 {
34  protected:
35  mutable float m_x0, m_y0, m_z0;
36  mutable float m_x1, m_y1, m_z1;
37  float m_headRatio;
39  // For version 2 in stream
40  float m_arrow_roll;
42  float m_arrow_yaw;
43 
44  public:
46  float x0, float y0, float z0, float x1, float y1, float z1)
47  {
48  m_x0 = x0;
49  m_y0 = y0;
50  m_z0 = z0;
51  m_x1 = x1;
52  m_y1 = y1;
53  m_z1 = z1;
55  }
56  void setHeadRatio(float rat)
57  {
58  m_headRatio = rat;
60  }
61  void setSmallRadius(float rat)
62  {
63  m_smallRadius = rat;
65  }
66  void setLargeRadius(float rat)
67  {
68  m_largeRadius = rat;
70  }
71  void setArrowYawPitchRoll(float yaw, float pitch, float roll)
72  {
73  m_arrow_yaw = yaw;
77  }
78 
79  /** Render
80  */
81  void render_dl() const override;
82 
83  /** Evaluates the bounding box of this object (including possible children)
84  * in the coordinate frame of the object parent. */
85  void getBoundingBox(
86  mrpt::math::TPoint3D& bb_min,
87  mrpt::math::TPoint3D& bb_max) const override;
88 
89  /** Class factory */
90  static CArrow::Ptr Create(
91  float x0, float y0, float z0, float x1, float y1, float z1,
92  float headRatio = 0.2f, float smallRadius = 0.05f,
93  float largeRadius = 0.2f, float arrow_roll = -1.0f,
94  float arrow_pitch = -1.0f, float arrow_yaw = -1.0f);
95 
96  /** Constructor
97  */
99  float x0 = 0, float y0 = 0, float z0 = 0, float x1 = 1, float y1 = 1,
100  float z1 = 1, float headRatio = 0.2f, float smallRadius = 0.05f,
101  float largeRadius = 0.2f, float arrow_roll = -1.0f,
102  float arrow_pitch = -1.0f, float arrow_yaw = -1.0f)
103  : m_x0(x0),
104  m_y0(y0),
105  m_z0(z0),
106  m_x1(x1),
107  m_y1(y1),
108  m_z1(z1),
109  m_headRatio(headRatio),
110  m_smallRadius(smallRadius),
111  m_largeRadius(largeRadius),
112  m_arrow_roll(arrow_roll),
113  m_arrow_pitch(arrow_pitch),
114  m_arrow_yaw(arrow_yaw)
115  {
116  }
117 
118  /** Private, virtual destructor: only can be deleted from smart pointers */
119  virtual ~CArrow() {}
120 };
121 
122 } // end namespace
123 } // End of namespace
124 
125 #endif
void setArrowEnds(float x0, float y0, float z0, float x1, float y1, float z1)
Definition: CArrow.h:45
void setLargeRadius(float rat)
Definition: CArrow.h:66
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:224
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:98
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:41
A renderizable object suitable for rendering with OpenGL&#39;s display lists.
float m_arrow_roll
Definition: CArrow.h:40
void setSmallRadius(float rat)
Definition: CArrow.h:61
virtual ~CArrow()
Private, virtual destructor: only can be deleted from smart pointers.
Definition: CArrow.h:119
static Ptr Create(Args &&... args)
Definition: CArrow.h:33
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#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:71
float m_largeRadius
Definition: CArrow.h:38
void setHeadRatio(float rat)
Definition: CArrow.h:56
A 3D arrow.
Definition: CArrow.h:31
Lightweight 3D point.
float m_smallRadius
Definition: CArrow.h:38
INT32 z1
Definition: jidctint.cpp:130
std::shared_ptr< CArrow > Ptr
Definition: CArrow.h:33



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019