Main MRPT website > C++ reference for MRPT 1.4.0
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-2016, 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
14namespace mrpt
15{
16 namespace opengl
17 {
18
19
20 // This must be added to any CSerializable derived class:
22
23 /** A 3D arrow
24 * \sa opengl::COpenGLScene
25 *
26 * <div align="center">
27 * <table border="0" cellspan="4" cellspacing="4" style="border-width: 1px; border-style: solid;">
28 * <tr> <td> mrpt::opengl::CArrow </td> <td> \image html preview_CArrow.png </td> </tr>
29 * </table>
30 * </div>
31 * \ingroup mrpt_opengl_grp
32 *
33 */
35 {
37 protected:
38 mutable float m_x0,m_y0,m_z0;
39 mutable float m_x1,m_y1,m_z1;
41 float m_smallRadius, m_largeRadius;
42 //For version 2 in stream
46
47 public:
48
49 void setArrowEnds(float x0,float y0, float z0, float x1,float y1, float z1)
50 {
51 m_x0=x0; m_y0 = y0; m_z0=z0;
52 m_x1=x1; m_y1 = y1; m_z1=z1;
54 }
55 void setHeadRatio(float rat) { m_headRatio=rat; CRenderizableDisplayList::notifyChange(); }
56 void setSmallRadius(float rat) { m_smallRadius=rat; CRenderizableDisplayList::notifyChange(); }
57 void setLargeRadius(float rat) { m_largeRadius=rat; CRenderizableDisplayList::notifyChange(); }
58 void setArrowYawPitchRoll(float yaw,float pitch, float roll ) { m_arrow_yaw=yaw; m_arrow_pitch=pitch; m_arrow_roll=roll; CRenderizableDisplayList::notifyChange(); }
59
60 /** Render
61 */
63
64 /** Evaluates the bounding box of this object (including possible children) in the coordinate frame of the object parent. */
65 void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const MRPT_OVERRIDE;
66
67 /** Class factory */
68 static CArrowPtr Create(
69 float x0,float y0,float z0,
70 float x1,float y1,float z1,
71 float headRatio = 0.2f,float smallRadius = 0.05f,float largeRadius = 0.2f,
72 float arrow_roll = -1.0f,float arrow_pitch = -1.0f,float arrow_yaw = -1.0f);
73
74 private:
75 /** Constructor
76 */
78 float x0 = 0,
79 float y0 = 0,
80 float z0 = 0,
81 float x1 = 1,
82 float y1 = 1,
83 float z1 = 1,
84 float headRatio = 0.2f,
85 float smallRadius = 0.05f,
86 float largeRadius = 0.2f,
87 float arrow_roll = -1.0f,
88 float arrow_pitch = -1.0f,
89 float arrow_yaw = -1.0f
90 ) :
91 m_x0(x0),m_y0(y0),m_z0(z0),
92 m_x1(x1),m_y1(y1),m_z1(z1),
93 m_headRatio(headRatio),
94 m_smallRadius(smallRadius),
95 m_largeRadius(largeRadius),
96 m_arrow_roll(arrow_roll),
97 m_arrow_pitch(arrow_pitch),
98 m_arrow_yaw(arrow_yaw)
99 {
100 }
101
102 /** Private, virtual destructor: only can be deleted from smart pointers */
103 virtual ~CArrow() { }
104 };
105 DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE( CArrow, CRenderizableDisplayList, OPENGL_IMPEXP )
106
107
108 } // end namespace
109} // End of namespace
110
111#endif
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
A 3D arrow.
Definition: CArrow.h:35
void render_dl() const MRPT_OVERRIDE
Render.
virtual ~CArrow()
Private, virtual destructor: only can be deleted from smart pointers.
Definition: CArrow.h:103
float m_arrow_roll
Definition: CArrow.h:43
float m_arrow_pitch
Definition: CArrow.h:44
float m_largeRadius
Definition: CArrow.h:41
void setArrowYawPitchRoll(float yaw, float pitch, float roll)
Definition: CArrow.h:58
void setSmallRadius(float rat)
Definition: CArrow.h:56
void setLargeRadius(float rat)
Definition: CArrow.h:57
void setArrowEnds(float x0, float y0, float z0, float x1, float y1, float z1)
Definition: CArrow.h:49
void setHeadRatio(float rat)
Definition: CArrow.h:55
A renderizable object suitable for rendering with OpenGL's display lists.
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated)
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
Definition: mrpt_macros.h:28
struct OPENGL_IMPEXP CArrowPtr
Definition: CArrow.h:21
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.



Page generated by Doxygen 1.9.6 for MRPT 1.4.0 SVN: at Tue Jan 17 22:27:43 UTC 2023