Main MRPT website > C++ reference
MRPT logo
CGridPlaneXZ.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | The Mobile Robot Programming Toolkit (MRPT) C++ library |
3  | |
4  | http://www.mrpt.org/ |
5  | |
6  | Copyright (C) 2005-2012 University of Malaga |
7  | |
8  | This software was written by the Machine Perception and Intelligent |
9  | Robotics Lab, University of Malaga (Spain). |
10  | Contact: Jose-Luis Blanco <jlblanco@ctima.uma.es> |
11  | |
12  | This file is part of the MRPT project. |
13  | |
14  | MRPT is free software: you can redistribute it and/or modify |
15  | it under the terms of the GNU General Public License as published by |
16  | the Free Software Foundation, either version 3 of the License, or |
17  | (at your option) any later version. |
18  | |
19  | MRPT is distributed in the hope that it will be useful, |
20  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
21  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
22  | GNU General Public License for more details. |
23  | |
24  | You should have received a copy of the GNU General Public License |
25  | along with MRPT. If not, see <http://www.gnu.org/licenses/>. |
26  | |
27  +---------------------------------------------------------------------------+ */
28 
29 #ifndef opengl_CGridPlaneXZ_H
30 #define opengl_CGridPlaneXZ_H
31 
33 
34 namespace mrpt
35 {
36  namespace opengl
37  {
39 
40  // This must be added to any CSerializable derived class:
42 
43  /** A grid of lines over the XZ plane.
44  * \sa opengl::COpenGLScene
45  *
46  * <div align="center">
47  * <table border="0" cellspan="4" cellspacing="4" style="border-width: 1px; border-style: solid;">
48  * <tr> <td> mrpt::opengl::CGridPlaneXZ </td> <td> \image html preview_CGridPlaneXZ.png </td> </tr>
49  * </table>
50  * </div>
51  *
52  * \ingroup mrpt_opengl_grp
53  */
55  {
57 
58  protected:
59  float m_xMin, m_xMax;
60  float m_zMin, m_zMax;
61  float m_plane_y;
62  float m_frequency;
63 
64  public:
65 
66  void setPlaneLimits(float xmin,float xmax, float zmin, float zmax)
67  {
68  m_xMin=xmin; m_xMax = xmax;
69  m_zMin=zmin; m_zMax = zmax;
71  }
72 
73  void getPlaneLimits(float &xmin,float &xmax, float &zmin, float &zmax) const
74  {
75  xmin=m_xMin; xmax=m_xMax;
76  zmin=m_zMin; zmax=m_zMax;
77  }
78 
79  void setPlaneYcoord(float y) { m_plane_y=y; CRenderizableDisplayList::notifyChange(); }
80  float getPlaneYcoord() const { return m_plane_y; }
81 
82  void setGridFrequency(float freq) { ASSERT_(freq>0); m_frequency=freq; CRenderizableDisplayList::notifyChange(); }
83  float getGridFrequency() const { return m_frequency; }
84 
85 
86 
87  /** Class factory */
88  static CGridPlaneXZPtr Create(
89  float xMin = -10,
90  float xMax = 10,
91  float zMin = -10,
92  float zMax = 10,
93  float y = 0,
94  float frequency = 1
95  )
96  {
97  return CGridPlaneXZPtr( new CGridPlaneXZ( xMin,xMax, zMin, zMax, y, frequency ) );
98  }
99 
100  /** Render
101  */
102  void render_dl() const;
103 
104  private:
105  /** Constructor
106  */
108  float xMin = -10,
109  float xMax = 10,
110  float zMin = -10,
111  float zMax = 10,
112  float y = 0,
113  float frequency = 1
114  ) :
115  m_xMin(xMin),m_xMax(xMax),
116  m_zMin(zMin),m_zMax(zMax),
117  m_plane_y(y),
118  m_frequency(frequency)
119  {
120  }
121  /** Private, virtual destructor: only can be deleted from smart pointers */
122  virtual ~CGridPlaneXZ() { }
123  };
124 
125  } // end namespace
126 
127 } // End of namespace
128 
129 
130 #endif



Page generated by Doxygen 1.8.3 for MRPT 0.9.6 SVN: at Fri Feb 15 22:05:02 EST 2013