Main MRPT website > C++ reference for MRPT 1.4.0
CSimpleLine.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_CSimpleLine_H
10#define opengl_CSimpleLine_H
11
13
14namespace mrpt
15{
16 namespace opengl
17 {
18
19
20 // This must be added to any CSerializable derived class:
22
23 /** A line segment
24 * \sa opengl::COpenGLScene
25 * \ingroup mrpt_opengl_grp
26 */
28 {
30
31 protected:
32 float m_x0,m_y0,m_z0;
33 float m_x1,m_y1,m_z1;
36 public:
37 void setLineWidth(float w) { m_lineWidth=w; CRenderizableDisplayList::notifyChange(); }
38 float getLineWidth() const { return m_lineWidth;}
39
40 void enableAntiAliasing(bool enable=true) { m_antiAliasing =enable; CRenderizableDisplayList::notifyChange(); }
41 bool isAntiAliasingEnabled() const { return m_antiAliasing; }
42
43 void setLineCoords(float x0,float y0,float z0, float x1, float y1, float z1)
44 {
45 m_x0=x0; m_y0=y0; m_z0=z0;
46 m_x1=x1; m_y1=y1; m_z1=z1;
48 }
49
50 void getLineCoords(float &x0,float &y0,float &z0, float &x1, float &y1, float &z1) const
51 {
52 x0=m_x0; y0=m_y0; z0=m_z0;
53 x1=m_x1; y1=m_y1; z1=m_z1;
54 }
55
56 /** Render
57 */
59
60 /** Class factory */
61 static CSimpleLinePtr Create(
62 float x0,float y0, float z0,
63 float x1,float y1, float z1, float lineWidth = 1 );
64
65 /** Evaluates the bounding box of this object (including possible children) in the coordinate frame of the object parent. */
66 void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const MRPT_OVERRIDE;
67
68 private:
69 /** Constructor
70 */
72 float x0=0,float y0=0, float z0=0,
73 float x1=0,float y1=0, float z1=0, float lineWidth = 1,
74 bool antiAliasing = true);
75
76 /** Private, virtual destructor: only can be deleted from smart pointers */
77 virtual ~CSimpleLine() { }
78 };
79 DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE( CSimpleLine, CRenderizableDisplayList, OPENGL_IMPEXP )
80
81 } // end namespace
82
83} // End of namespace
84
85
86#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 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)
void setLineCoords(float x0, float y0, float z0, float x1, float y1, float z1)
Definition: CSimpleLine.h:43
bool isAntiAliasingEnabled() const
Definition: CSimpleLine.h:41
void setLineWidth(float w)
Definition: CSimpleLine.h:37
void enableAntiAliasing(bool enable=true)
Definition: CSimpleLine.h:40
float getLineWidth() const
Definition: CSimpleLine.h:38
void getLineCoords(float &x0, float &y0, float &z0, float &x1, float &y1, float &z1) const
Definition: CSimpleLine.h:50
void render_dl() const MRPT_OVERRIDE
Render.
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
Definition: mrpt_macros.h:28
struct OPENGL_IMPEXP CSimpleLinePtr
Definition: CSimpleLine.h:21
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 Wed Mar 22 06:16:42 UTC 2023