Main MRPT website > C++ reference for MRPT 1.9.9
CTexturedPlane.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_CTexturedPlane_H
10 #define opengl_CTexturedPlane_H
11 
13 
14 namespace mrpt
15 {
16 namespace opengl
17 {
18 /** A 2D plane in the XY plane with a texture image.
19  * \sa opengl::COpenGLScene
20  * \ingroup mrpt_opengl_grp
21  */
23 {
25  protected:
26  mutable float m_tex_x_min, m_tex_x_max;
27  mutable float m_tex_y_min, m_tex_y_max;
28 
29  float m_xMin, m_xMax;
30  float m_yMin, m_yMax;
31 
32  mutable bool polygonUpToDate;
33  /** Used for ray-tracing */
34  mutable std::vector<mrpt::math::TPolygonWithPlane> tmpPoly;
35  void updatePoly() const;
36  void unloadTexture();
37 
38  void render_texturedobj() const override;
39 
40  public:
41  /** Set the texture coordinates of the four corners (in the range 0-1). */
43  float tex_x_min, float tex_x_max, float tex_y_min, float tex_y_max)
44  {
45  m_tex_x_min = tex_x_min;
46  m_tex_x_max = tex_x_max;
47  m_tex_y_min = tex_y_min;
48  m_tex_y_max = tex_y_max;
50  }
51 
52  /** Set the coordinates of the four corners that define the plane on the XY
53  * plane. */
54  void setPlaneCorners(float xMin, float xMax, float yMin, float yMax)
55  {
56  m_xMin = xMin;
57  m_xMax = xMax;
58  m_yMin = yMin;
59  m_yMax = yMax;
60  polygonUpToDate = false;
62  }
63 
64  /** Get the coordinates of the four corners that define the plane on the XY
65  * plane. */
66  inline void getPlaneCorners(
67  float& xMin, float& xMax, float& yMin, float& yMax) const
68  {
69  xMin = m_xMin;
70  xMax = m_xMax;
71  yMin = m_yMin;
72  yMax = m_yMax;
73  }
74 
75  /** Class factory */
77  float x_min, float x_max, float y_min, float y_max);
78 
79  virtual bool traceRay(
80  const mrpt::poses::CPose3D& o, double& dist) const override;
81  virtual void getBoundingBox(
82  mrpt::math::TPoint3D& bb_min,
83  mrpt::math::TPoint3D& bb_max) const override;
84 
85  /** Constructor
86  */
88  float x_min = -1, float x_max = 1, float y_min = -1, float y_max = 1);
89 
90  /** Private, virtual destructor: only can be deleted from smart pointers */
91  virtual ~CTexturedPlane();
92 };
93 
94 } // end namespace
95 
96 } // End of namespace
97 
98 #endif
mrpt::opengl::CTexturedPlane::render_texturedobj
void render_texturedobj() const override
Must be implemented by derived classes.
Definition: CTexturedPlane.cpp:53
mrpt::opengl::CTexturedPlane::m_tex_y_max
float m_tex_y_max
Definition: CTexturedPlane.h:27
mrpt::opengl::CTexturedPlane::m_tex_y_min
float m_tex_y_min
Definition: CTexturedPlane.h:27
mrpt::opengl::CTexturedPlane::m_tex_x_min
float m_tex_x_min
Definition: CTexturedPlane.h:26
mrpt::opengl::CTexturedPlane::Ptr
std::shared_ptr< CTexturedPlane > Ptr
Definition: CTexturedPlane.h:24
mrpt::opengl::CTexturedPlane::setTextureCornerCoords
void setTextureCornerCoords(float tex_x_min, float tex_x_max, float tex_y_min, float tex_y_max)
Set the texture coordinates of the four corners (in the range 0-1).
Definition: CTexturedPlane.h:42
mrpt::opengl::CTexturedPlane::traceRay
virtual bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const override
Simulation of ray-trace, given a pose.
Definition: CTexturedPlane.cpp:146
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::CTexturedPlane::getPlaneCorners
void getPlaneCorners(float &xMin, float &xMax, float &yMin, float &yMax) const
Get the coordinates of the four corners that define the plane on the XY plane.
Definition: CTexturedPlane.h:66
mrpt
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Definition: CKalmanFilterCapable.h:30
mrpt::opengl::CTexturedPlane
A 2D plane in the XY plane with a texture image.
Definition: CTexturedPlane.h:22
mrpt::opengl::CTexturedPlane::m_yMax
float m_yMax
Definition: CTexturedPlane.h:30
mrpt::opengl::CTexturedPlane::Create
static Ptr Create(Args &&... args)
Definition: CTexturedPlane.h:24
mrpt::opengl::CTexturedPlane::unloadTexture
void unloadTexture()
mrpt::opengl::CTexturedPlane::~CTexturedPlane
virtual ~CTexturedPlane()
Private, virtual destructor: only can be deleted from smart pointers.
Definition: CTexturedPlane.cpp:49
mrpt::opengl::CTexturedPlane::m_tex_x_max
float m_tex_x_max
Definition: CTexturedPlane.h:26
mrpt::opengl::CTexturedPlane::tmpPoly
std::vector< mrpt::math::TPolygonWithPlane > tmpPoly
Used for ray-tracing.
Definition: CTexturedPlane.h:34
mrpt::opengl::CTexturedPlane::m_xMax
float m_xMax
Definition: CTexturedPlane.h:29
mrpt::poses::CPose3D
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:88
mrpt::opengl::CTexturedObject
A base class for all OpenGL objects with loadable textures.
Definition: CTexturedObject.h:25
mrpt::opengl::CTexturedPlane::updatePoly
void updatePoly() const
Definition: CTexturedPlane.cpp:152
mrpt::opengl::CTexturedPlane::setPlaneCorners
void setPlaneCorners(float xMin, float xMax, float yMin, float yMax)
Set the coordinates of the four corners that define the plane on the XY plane.
Definition: CTexturedPlane.h:54
mrpt::math::TPoint3D
Lightweight 3D point.
Definition: lightweight_geom_data.h:378
mrpt::opengl::CTexturedPlane::CTexturedPlane
CTexturedPlane(float x_min=-1, float x_max=1, float y_min=-1, float y_max=1)
Constructor.
Definition: CTexturedPlane.cpp:35
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
mrpt::opengl::CTexturedPlane::polygonUpToDate
bool polygonUpToDate
Definition: CTexturedPlane.h:32
mrpt::opengl::CTexturedPlane::m_yMin
float m_yMin
Definition: CTexturedPlane.h:30
CTexturedObject.h
mrpt::opengl::CTexturedPlane::m_xMin
float m_xMin
Definition: CTexturedPlane.h:29
mrpt::opengl::CTexturedPlane::getBoundingBox
virtual 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: CTexturedPlane.cpp:165



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