MRPT  2.0.2
CGridPlaneXZ.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2020, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #include "opengl-precomp.h" // Precompiled header
11 
14 
15 using namespace mrpt;
16 using namespace mrpt::opengl;
17 using namespace std;
18 
21 
22 /** Constructor */
24  float xMin, float xMax, float zMin, float zMax, float y, float frequency,
25  float lineWidth, bool antiAliasing)
26  : m_xMin(xMin),
27  m_xMax(xMax),
28  m_zMin(zMin),
29  m_zMax(zMax),
30  m_plane_y(y),
31  m_frequency(frequency)
32 {
33  m_lineWidth = lineWidth;
34  m_antiAliasing = antiAliasing;
35 }
36 
37 void CGridPlaneXZ::onUpdateBuffers_Wireframe()
38 {
39  // Generate vertices:
40  m_vertex_buffer_data.clear();
41  m_color_buffer_data.clear();
42 
43  for (float z = m_zMin; z <= m_zMax; z += m_frequency)
44  {
45  m_vertex_buffer_data.emplace_back(m_xMin, m_plane_y, z);
46  m_vertex_buffer_data.emplace_back(m_xMax, m_plane_y, z);
47  }
48 
49  for (float x = m_xMin; x <= m_xMax; x += m_frequency)
50  {
51  m_vertex_buffer_data.emplace_back(x, m_plane_y, m_zMin);
52  m_vertex_buffer_data.emplace_back(x, m_plane_y, m_zMax);
53  }
54  // The same color to all vertices:
56 }
57 
58 uint8_t CGridPlaneXZ::serializeGetVersion() const { return 1; }
60 {
62  out << m_xMin << m_xMax;
63  out << m_zMin << m_zMax << m_plane_y;
64  out << m_frequency;
65  out << m_lineWidth << m_antiAliasing; // v1
66 }
67 
69  mrpt::serialization::CArchive& in, uint8_t version)
70 {
71  switch (version)
72  {
73  case 0:
74  case 1:
75  {
77  in >> m_xMin >> m_xMax;
78  in >> m_zMin >> m_zMax >> m_plane_y;
79  in >> m_frequency;
80  if (version >= 1)
81  in >> m_lineWidth >> m_antiAliasing;
82  else
83  {
84  m_lineWidth = 1.0f;
85  m_antiAliasing = true;
86  }
87  }
88  break;
89  default:
91  };
93 }
94 
97 {
98  bb_min.x = m_xMin;
99  bb_min.y = 0;
100  bb_min.z = m_zMin;
101 
102  bb_max.x = m_xMax;
103  bb_max.y = 0;
104  bb_max.z = m_zMax;
105 
106  // Convert to coordinates of my parent:
109 }
CGridPlaneXZ(float xMin=-10, float xMax=10, float zMin=-10, float zMax=10, float y=0, float frequency=1, float lineWidth=1.3f, bool antiAliasing=true)
Constructor.
void notifyChange() const
Call to enable calling renderUpdateBuffers() before the next render() rendering iteration.
STL namespace.
IMPLEMENTS_SERIALIZABLE(CGridPlaneXZ, CRenderizableShaderWireFrame, mrpt::opengl) CGridPlaneXZ
Constructor.
mrpt::poses::CPose3D m_pose
6D pose wrt the parent coordinate reference.
Definition: CRenderizable.h:62
A grid of lines over the XZ plane.
Definition: CGridPlaneXZ.h:29
std::vector< mrpt::math::TPoint3Df > m_vertex_buffer_data
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
Definition: exceptions.h:97
void writeToStreamRender(mrpt::serialization::CArchive &out) const
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
mrpt::img::TColor m_color
Color components in the range [0,255].
Definition: CRenderizable.h:59
std::vector< mrpt::img::TColor > m_color_buffer_data
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Virtual base class for "archives": classes abstracting I/O streams.
Definition: CArchive.h:54
mrpt::vision::TStereoCalibResults out
Renderizable generic renderer for objects using the wireframe shader.
The namespace for 3D scene representation and rendering.
Definition: CGlCanvasBase.h:13
const auto bb_max
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...
void readFromStreamRender(mrpt::serialization::CArchive &in)
void composePoint(double lx, double ly, double lz, double &gx, double &gy, double &gz, mrpt::optional_ref< mrpt::math::CMatrixDouble33 > out_jacobian_df_dpoint=std::nullopt, mrpt::optional_ref< mrpt::math::CMatrixDouble36 > out_jacobian_df_dpose=std::nullopt, mrpt::optional_ref< mrpt::math::CMatrixDouble36 > out_jacobian_df_dse3=std::nullopt, bool use_small_rot_approx=false) const
An alternative, slightly more efficient way of doing with G and L being 3D points and P this 6D pose...
const auto bb_min
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.



Page generated by Doxygen 1.8.14 for MRPT 2.0.2 Git: 9b4fd2465 Mon May 4 16:59:08 2020 +0200 at lun may 4 17:26:07 CEST 2020