Main MRPT website > C++ reference for MRPT 1.4.0
CAxis.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_CAxis_H
10#define opengl_CAxis_H
11
13
14namespace mrpt
15{
16 namespace opengl
17 {
18
19
20 // This must be added to any CSerializable derived class:
22
23 /** Draw a 3D world axis, with coordinate marks at some regular interval
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::CAxis </td> <td> \image html preview_CAxis.png </td> </tr>
29 * </table>
30 * </div>
31 *
32 * \ingroup mrpt_opengl_grp
33 */
35 {
37 protected:
38 float m_xmin,m_ymin,m_zmin;
39 float m_xmax,m_ymax,m_zmax;
42 bool m_marks;
43
44 public:
45 void setAxisLimits(float xmin,float ymin, float zmin, float xmax,float ymax, float zmax)
46 {
47 m_xmin=xmin; m_ymin=ymin; m_zmin=zmin;
48 m_xmax=xmax; m_ymax=ymax; m_zmax=zmax;
50 }
51
52 void setFrequency(float f) { ASSERT_(f>0); m_frecuency=f; CRenderizableDisplayList::notifyChange(); } //!< Changes the frequency of the "ticks"
53
54 void setLineWidth(float w) { m_lineWidth=w; CRenderizableDisplayList::notifyChange(); }
55 float getLineWidth() const { return m_lineWidth;}
56
57 void enableTickMarks(bool v=true) { m_marks=v; CRenderizableDisplayList::notifyChange(); }
58
59
60 /** Class factory */
61 static CAxisPtr Create(
62 float xmin,float ymin, float zmin,
63 float xmax, float ymax, float zmax,
64 float frecuency = 1, float lineWidth = 3, bool marks=false);
65
66 /** Render
67 */
69
70 /** Evaluates the bounding box of this object (including possible children) in the coordinate frame of the object parent. */
71 void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const MRPT_OVERRIDE;
72
73 private:
74 /** Constructor
75 */
77 float xmin=-1.0f,float ymin=-1.0f, float zmin=-1.0f,
78 float xmax=1.0f, float ymax=1.0f, float zmax=1.0f,
79 float frecuency = 0.25f, float lineWidth = 3.0f, bool marks=false) :
80 m_xmin(xmin),m_ymin(ymin),m_zmin(zmin),
81 m_xmax(xmax),m_ymax(ymax),m_zmax(zmax),
82 m_frecuency(frecuency),
83 m_lineWidth(lineWidth),
84 m_marks(marks)
85 {
86 }
87
88 /** Private, virtual destructor: only can be deleted from smart pointers */
89 virtual ~CAxis() { }
90 };
91 DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE( CAxis, CRenderizableDisplayList, OPENGL_IMPEXP )
92
93 } // end namespace
94} // End of namespace
95
96#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...
Draw a 3D world axis, with coordinate marks at some regular interval.
Definition: CAxis.h:35
void enableTickMarks(bool v=true)
Definition: CAxis.h:57
void setFrequency(float f)
Changes the frequency of the "ticks".
Definition: CAxis.h:52
static CAxisPtr Create(float xmin, float ymin, float zmin, float xmax, float ymax, float zmax, float frecuency=1, float lineWidth=3, bool marks=false)
Class factory
float m_lineWidth
Definition: CAxis.h:41
virtual ~CAxis()
Private, virtual destructor: only can be deleted from smart pointers.
Definition: CAxis.h:89
float getLineWidth() const
Definition: CAxis.h:55
void render_dl() const MRPT_OVERRIDE
Render.
void setAxisLimits(float xmin, float ymin, float zmin, float xmax, float ymax, float zmax)
Definition: CAxis.h:45
float m_frecuency
Definition: CAxis.h:40
void setLineWidth(float w)
Definition: CAxis.h:54
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
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.



Page generated by Doxygen 1.9.2 for MRPT 1.4.0 SVN: at Mon Sep 20 00:47:55 UTC 2021