MRPT  1.9.9
CGridPlaneXY.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 
10 #pragma once
11 
13 
14 namespace mrpt::opengl
15 {
16 /** A grid of lines over the XY plane.
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::CGridPlaneXY </td> <td> \image html
23  * preview_CGridPlaneXY.png </td> </tr>
24  * </table>
25  * </div>
26  *
27  * \ingroup mrpt_opengl_grp
28  */
30 {
32 
33  protected:
34  float m_xMin, m_xMax;
35  float m_yMin, m_yMax;
36  float m_plane_z;
37  float m_frequency;
38  float m_lineWidth;
40 
41  public:
42  void setLineWidth(float w)
43  {
44  m_lineWidth = w;
46  }
47  float getLineWidth() const { return m_lineWidth; }
48  void enableAntiAliasing(bool enable = true)
49  {
50  m_antiAliasing = enable;
52  }
53  bool isAntiAliasingEnabled() const { return m_antiAliasing; }
54  void setPlaneLimits(float xmin, float xmax, float ymin, float ymax)
55  {
56  m_xMin = xmin;
57  m_xMax = xmax;
58  m_yMin = ymin;
59  m_yMax = ymax;
61  }
62 
64  float& xmin, float& xmax, float& ymin, float& ymax) const
65  {
66  xmin = m_xMin;
67  xmax = m_xMax;
68  ymin = m_yMin;
69  ymax = m_yMax;
70  }
71 
72  void setPlaneZcoord(float z)
73  {
75  m_plane_z = z;
76  }
77  float getPlaneZcoord() const { return m_plane_z; }
78  void setGridFrequency(float freq)
79  {
80  ASSERT_(freq > 0);
81  m_frequency = freq;
83  }
84  float getGridFrequency() const { return m_frequency; }
85  /** Render */
86  void render_dl() const override;
87 
88  /** Evaluates the bounding box of this object (including possible children)
89  * in the coordinate frame of the object parent. */
90  void getBoundingBox(
92  mrpt::math::TPoint3D& bb_max) const override;
93 
94  /** Constructor */
96  float xMin = -10, float xMax = 10, float yMin = -10, float yMax = 10,
97  float z = 0, float frequency = 1, float lineWidth = 1.3f,
98  bool antiAliasing = true);
99 
100  /** Private, virtual destructor: only can be deleted from smart pointers */
101  ~CGridPlaneXY() override = default;
102 };
103 
104 } // namespace mrpt::opengl
void enableAntiAliasing(bool enable=true)
Definition: CGridPlaneXY.h:48
void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated) ...
GLdouble GLdouble z
Definition: glext.h:3879
A grid of lines over the XY plane.
Definition: CGridPlaneXY.h:29
void render_dl() const override
Render.
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...
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:4199
A renderizable object suitable for rendering with OpenGL&#39;s display lists.
void setGridFrequency(float freq)
Definition: CGridPlaneXY.h:78
#define ASSERT_(f)
Defines an assertion mechanism.
Definition: exceptions.h:120
float getGridFrequency() const
Definition: CGridPlaneXY.h:84
~CGridPlaneXY() override=default
Private, virtual destructor: only can be deleted from smart pointers.
void setPlaneLimits(float xmin, float xmax, float ymin, float ymax)
Definition: CGridPlaneXY.h:54
CGridPlaneXY(float xMin=-10, float xMax=10, float yMin=-10, float yMax=10, float z=0, float frequency=1, float lineWidth=1.3f, bool antiAliasing=true)
Constructor.
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
void setPlaneZcoord(float z)
Definition: CGridPlaneXY.h:72
bool isAntiAliasingEnabled() const
Definition: CGridPlaneXY.h:53
The namespace for 3D scene representation and rendering.
Definition: CGlCanvasBase.h:15
const auto bb_max
const auto bb_min
float getLineWidth() const
Definition: CGridPlaneXY.h:47
Lightweight 3D point.
Definition: TPoint3D.h:90
void getPlaneLimits(float &xmin, float &xmax, float &ymin, float &ymax) const
Definition: CGridPlaneXY.h:63
float getPlaneZcoord() const
Definition: CGridPlaneXY.h:77
void setLineWidth(float w)
Definition: CGridPlaneXY.h:42



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