Main MRPT website > C++ reference
MRPT logo
CAxis.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 #ifndef opengl_CAxis_H
29 #define opengl_CAxis_H
30 
32 
33 namespace mrpt
34 {
35  namespace opengl
36  {
38 
39  // This must be added to any CSerializable derived class:
41 
42  /** Draw a 3D world axis, with coordinate marks at some regular interval
43  * \sa opengl::COpenGLScene
44  *
45  * <div align="center">
46  * <table border="0" cellspan="4" cellspacing="4" style="border-width: 1px; border-style: solid;">
47  * <tr> <td> mrpt::opengl::CAxis </td> <td> \image html preview_CAxis.png </td> </tr>
48  * </table>
49  * </div>
50  *
51  * \ingroup mrpt_opengl_grp
52  */
54  {
56  protected:
57  float m_xmin,m_ymin,m_zmin;
58  float m_xmax,m_ymax,m_zmax;
59  float m_frecuency;
60  float m_lineWidth;
61  bool m_marks;
62 
63  public:
64  void setAxisLimits(float xmin,float ymin, float zmin, float xmax,float ymax, float zmax)
65  {
66  m_xmin=xmin; m_ymin=ymin; m_zmin=zmin;
67  m_xmax=xmax; m_ymax=ymax; m_zmax=zmax;
69  }
70 
71  void setFrequency(float f) { ASSERT_(f>0); m_frecuency=f; CRenderizableDisplayList::notifyChange(); } //!< Changes the frequency of the "ticks"
72 
73  void setLineWidth(float w) { m_lineWidth=w; CRenderizableDisplayList::notifyChange(); }
74  float getLineWidth() const { return m_lineWidth;}
75 
76  void enableTickMarks(bool v=true) { m_marks=v; CRenderizableDisplayList::notifyChange(); }
77 
78 
79  /** Class factory */
80  static CAxisPtr Create(
81  float xmin,float ymin, float zmin,
82  float xmax, float ymax, float zmax,
83  float frecuency = 1, float lineWidth = 3, bool marks=false)
84  {
85  return CAxisPtr( new CAxis( xmin,ymin, zmin, xmax,ymax,zmax,frecuency,lineWidth,marks ) );
86  }
87 
88  /** Render
89  */
90  void render_dl() const;
91 
92  private:
93  /** Constructor
94  */
96  float xmin=-1.0f,float ymin=-1.0f, float zmin=-1.0f,
97  float xmax=1.0f, float ymax=1.0f, float zmax=1.0f,
98  float frecuency = 0.25f, float lineWidth = 3.0f, bool marks=false) :
99  m_xmin(xmin),m_ymin(ymin),m_zmin(zmin),
100  m_xmax(xmax),m_ymax(ymax),m_zmax(zmax),
101  m_frecuency(frecuency),
102  m_lineWidth(lineWidth),
103  m_marks(marks)
104  {
105  }
106 
107  /** Private, virtual destructor: only can be deleted from smart pointers */
108  virtual ~CAxis() { }
109  };
110 
111  } // end namespace
112 } // End of namespace
113 
114 #endif



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