Main MRPT website > C++ reference for MRPT 1.9.9
CBox.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-2018, 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_CBox_H
10 #define opengl_CBox_H
11 
14 
15 namespace mrpt
16 {
17 namespace opengl
18 {
19 /** A solid or wireframe box in 3D, defined by 6 rectangular faces parallel to
20  *the planes X, Y and Z (note that the object can be translated and rotated
21  *afterwards as any other CRenderizable object using the "object pose" in the
22  *base class).
23  * Three drawing modes are possible:
24  * - Wireframe: setWireframe(true). Used color is the CRenderizable color
25  * - Solid box: setWireframe(false). Used color is the CRenderizable color
26  * - Solid box with border: setWireframe(false) + enableBoxBorder(true). Solid
27  *color is the CRenderizable color, border line can be set with
28  *setBoxBorderColor().
29  *
30  * \sa opengl::COpenGLScene,opengl::CRenderizable
31  *
32  * <div align="center">
33  * <table border="0" cellspan="4" cellspacing="4" style="border-width: 1px;
34  *border-style: solid;">
35  * <tr> <td> mrpt::opengl::CBox </td> <td> \image html preview_CBox.png </td>
36  *</tr>
37  * </table>
38  * </div>
39  *
40  * \ingroup mrpt_opengl_grp
41  */
43 {
45 
46  protected:
47  /** Corners coordinates */
49  /** true: wireframe, false: solid */
51  /** For wireframe only. */
52  float m_lineWidth;
53  /** Draw line borders to solid box with the given linewidth (default: true)
54  */
56  /** Color of the solid box borders. */
58 
59  public:
60  /** Constructor returning a smart pointer to the newly created object. */
61  static CBox::Ptr Create(
62  const mrpt::math::TPoint3D& corner1,
63  const mrpt::math::TPoint3D& corner2, bool is_wireframe = false,
64  float lineWidth = 1.0);
65 
66  /** Render
67  * \sa mrpt::opengl::CRenderizable
68  */
69  void render_dl() const override;
70 
71  /** Evaluates the bounding box of this object (including possible children)
72  * in the coordinate frame of the object parent. */
73  void getBoundingBox(
74  mrpt::math::TPoint3D& bb_min,
75  mrpt::math::TPoint3D& bb_max) const override;
76 
77  /**
78  * Ray tracing.
79  * \sa mrpt::opengl::CRenderizable
80  */
81  bool traceRay(const mrpt::poses::CPose3D& o, double& dist) const override;
82 
83  inline void setLineWidth(float width)
84  {
87  }
88  inline float getLineWidth() const { return m_lineWidth; }
89  inline void setWireframe(bool is_wireframe = true)
90  {
91  m_wireframe = is_wireframe;
93  }
94  inline bool isWireframe() const { return m_wireframe; }
95  inline void enableBoxBorder(bool drawBorder = true)
96  {
97  m_draw_border = drawBorder;
99  }
100  inline bool isBoxBorderEnabled() const { return m_draw_border; }
102  {
105  }
107  {
108  return m_solidborder_color;
109  }
110 
111  /** Set the position and size of the box, from two corners in 3D */
112  void setBoxCorners(
113  const mrpt::math::TPoint3D& corner1,
114  const mrpt::math::TPoint3D& corner2);
116  mrpt::math::TPoint3D& corner1, mrpt::math::TPoint3D& corner2) const
117  {
118  corner1 = m_corner_min;
119  corner2 = m_corner_max;
120  }
121 
122  /** Basic empty constructor. Set all parameters to default. */
123  CBox();
124 
125  /** Constructor with all the parameters */
126  CBox(
127  const mrpt::math::TPoint3D& corner1,
128  const mrpt::math::TPoint3D& corner2, bool is_wireframe = false,
129  float lineWidth = 1.0);
130 
131  /** Destructor */
132  virtual ~CBox() {}
133  private:
134 };
135 }
136 }
137 #endif
mrpt::opengl::CBox::enableBoxBorder
void enableBoxBorder(bool drawBorder=true)
Definition: CBox.h:95
mrpt::opengl::CBox::~CBox
virtual ~CBox()
Destructor
Definition: CBox.h:132
mrpt::opengl::CBox::getLineWidth
float getLineWidth() const
Definition: CBox.h:88
CRenderizableDisplayList.h
c
const GLubyte * c
Definition: glext.h:6313
mrpt::opengl::CBox::isWireframe
bool isWireframe() const
Definition: CBox.h:94
mrpt::opengl::CBox
A solid or wireframe box in 3D, defined by 6 rectangular faces parallel to the planes X,...
Definition: CBox.h:42
mrpt::opengl::CRenderizableDisplayList
A renderizable object suitable for rendering with OpenGL's display lists.
Definition: CRenderizableDisplayList.h:39
mrpt::opengl::CBox::CBox
CBox()
Basic empty constructor.
Definition: CBox.cpp:26
mrpt::opengl::CRenderizableDisplayList::notifyChange
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated)
Definition: CRenderizableDisplayList.h:57
mrpt::opengl::CBox::isBoxBorderEnabled
bool isBoxBorderEnabled() const
Definition: CBox.h:100
mrpt::opengl::CBox::m_corner_max
mrpt::math::TPoint3D m_corner_max
Definition: CBox.h:48
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
mrpt::opengl::CBox::m_draw_border
bool m_draw_border
Draw line borders to solid box with the given linewidth (default: true)
Definition: CBox.h:55
mrpt::opengl::CBox::getBoxCorners
void getBoxCorners(mrpt::math::TPoint3D &corner1, mrpt::math::TPoint3D &corner2) const
Definition: CBox.h:115
mrpt::opengl::CBox::setLineWidth
void setLineWidth(float width)
Definition: CBox.h:83
mrpt::opengl::CBox::Ptr
std::shared_ptr< CBox > Ptr
Definition: CBox.h:44
lightweight_geom_data.h
mrpt::opengl::CBox::traceRay
bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const override
Ray tracing.
Definition: CBox.cpp:256
mrpt::opengl::CBox::getBoxBorderColor
mrpt::img::TColor getBoxBorderColor() const
Definition: CBox.h:106
mrpt::opengl::CBox::m_corner_min
mrpt::math::TPoint3D m_corner_min
Corners coordinates.
Definition: CBox.h:48
mrpt::poses::CPose3D
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:88
mrpt::opengl::CBox::m_lineWidth
float m_lineWidth
For wireframe only.
Definition: CBox.h:52
mrpt::img::TColor
A RGB color - 8bit.
Definition: TColor.h:22
mrpt::opengl::CBox::m_solidborder_color
mrpt::img::TColor m_solidborder_color
Color of the solid box borders.
Definition: CBox.h:57
mrpt::math::TPoint3D
Lightweight 3D point.
Definition: lightweight_geom_data.h:378
mrpt::opengl::CBox::setBoxBorderColor
void setBoxBorderColor(const mrpt::img::TColor &c)
Definition: CBox.h:101
mrpt::opengl::CBox::render_dl
void render_dl() const override
Render.
Definition: CBox.cpp:50
DEFINE_SERIALIZABLE
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
Definition: CSerializable.h:102
width
GLenum GLsizei width
Definition: glext.h:3531
mrpt::opengl::CBox::m_wireframe
bool m_wireframe
true: wireframe, false: solid
Definition: CBox.h:50
mrpt::opengl::CBox::setBoxCorners
void setBoxCorners(const mrpt::math::TPoint3D &corner1, const mrpt::math::TPoint3D &corner2)
Set the position and size of the box, from two corners in 3D.
Definition: CBox.cpp:240
mrpt::opengl::CBox::Create
static Ptr Create(Args &&... args)
Definition: CBox.h:44
mrpt::opengl::CBox::getBoundingBox
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...
Definition: CBox.cpp:263
mrpt::opengl::CBox::setWireframe
void setWireframe(bool is_wireframe=true)
Definition: CBox.h:89



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST