Main MRPT website > C++ reference for MRPT 1.4.0
CGridPlaneXZ.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
10#ifndef opengl_CGridPlaneXZ_H
11#define opengl_CGridPlaneXZ_H
12
14
15namespace mrpt
16{
17 namespace opengl
18 {
19
20
21 // This must be added to any CSerializable derived class:
23
24 /** A grid of lines over the XZ plane.
25 * \sa opengl::COpenGLScene
26 *
27 * <div align="center">
28 * <table border="0" cellspan="4" cellspacing="4" style="border-width: 1px; border-style: solid;">
29 * <tr> <td> mrpt::opengl::CGridPlaneXZ </td> <td> \image html preview_CGridPlaneXZ.png </td> </tr>
30 * </table>
31 * </div>
32 *
33 * \ingroup mrpt_opengl_grp
34 */
36 {
38
39 protected:
40 float m_xMin, m_xMax;
41 float m_zMin, m_zMax;
42 float m_plane_y;
46
47 public:
48 void setLineWidth(float w) { m_lineWidth=w; CRenderizableDisplayList::notifyChange(); }
49 float getLineWidth() const { return m_lineWidth;}
50
51 void enableAntiAliasing(bool enable=true) { m_antiAliasing =enable; CRenderizableDisplayList::notifyChange(); }
52 bool isAntiAliasingEnabled() const { return m_antiAliasing; }
53
54 void setPlaneLimits(float xmin,float xmax, float zmin, float zmax)
55 {
56 m_xMin=xmin; m_xMax = xmax;
57 m_zMin=zmin; m_zMax = zmax;
59 }
60
61 void getPlaneLimits(float &xmin,float &xmax, float &zmin, float &zmax) const
62 {
63 xmin=m_xMin; xmax=m_xMax;
64 zmin=m_zMin; zmax=m_zMax;
65 }
66
68 float getPlaneYcoord() const { return m_plane_y; }
69
70 void setGridFrequency(float freq) { ASSERT_(freq>0); m_frequency=freq; CRenderizableDisplayList::notifyChange(); }
71 float getGridFrequency() const { return m_frequency; }
72
73
74
75 /** Class factory */
77 float xMin = -10,
78 float xMax = 10,
79 float zMin = -10,
80 float zMax = 10,
81 float y = 0,
82 float frequency = 1,
83 float lineWidth = 1.3f,
84 bool antiAliasing = true
85 );
86
87 /** Render
88 */
90
91 /** Evaluates the bounding box of this object (including possible children) in the coordinate frame of the object parent. */
92 void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const MRPT_OVERRIDE;
93 private:
94 /** Constructor */
96 float xMin = -10,
97 float xMax = 10,
98 float zMin = -10,
99 float zMax = 10,
100 float y = 0,
101 float frequency = 1,
102 float lineWidth = 1.3f,
103 bool antiAliasing = true
104 );
105 /** Private, virtual destructor: only can be deleted from smart pointers */
106 virtual ~CGridPlaneXZ() { }
107 };
108 DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE( CGridPlaneXZ, CRenderizableDisplayList, OPENGL_IMPEXP )
109
110 } // end namespace
111
112} // End of namespace
113
114
115#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 grid of lines over the XZ plane.
Definition: CGridPlaneXZ.h:36
void setPlaneLimits(float xmin, float xmax, float zmin, float zmax)
Definition: CGridPlaneXZ.h:54
void render_dl() const MRPT_OVERRIDE
Render.
void setGridFrequency(float freq)
Definition: CGridPlaneXZ.h:70
float getPlaneYcoord() const
Definition: CGridPlaneXZ.h:68
static CGridPlaneXZPtr Create(float xMin=-10, float xMax=10, float zMin=-10, float zMax=10, float y=0, float frequency=1, float lineWidth=1.3f, bool antiAliasing=true)
Class factory
void setPlaneYcoord(float y)
Definition: CGridPlaneXZ.h:67
float getLineWidth() const
Definition: CGridPlaneXZ.h:49
void setLineWidth(float w)
Definition: CGridPlaneXZ.h:48
void enableAntiAliasing(bool enable=true)
Definition: CGridPlaneXZ.h:51
void getPlaneLimits(float &xmin, float &xmax, float &zmin, float &zmax) const
Definition: CGridPlaneXZ.h:61
bool isAntiAliasingEnabled() const
Definition: CGridPlaneXZ.h:52
float getGridFrequency() const
Definition: CGridPlaneXZ.h:71
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 ASSERT_(f)
Definition: mrpt_macros.h:261
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
Definition: mrpt_macros.h:28
struct OPENGL_IMPEXP CGridPlaneXZPtr
Definition: CGridPlaneXZ.h:22
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 Fri Jan 20 00:13:14 UTC 2023