Main MRPT website > C++ reference for MRPT 1.9.9
CColouredPointsMap.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-2017, 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 CColouredPointsMap_H
10 #define CColouredPointsMap_H
11 
13 #include <mrpt/obs/obs_frwds.h>
16 #include <mrpt/math/CMatrix.h>
17 #include <mrpt/utils/TEnumType.h>
18 
19 namespace mrpt
20 {
21 namespace maps
22 {
23 /** A map of 2D/3D points with individual colours (RGB).
24  * For different color schemes, see CColouredPointsMap::colorScheme
25  * Colors are defined in the range [0,1].
26  * \sa mrpt::maps::CPointsMap, mrpt::maps::CMetricMap,
27  * mrpt::utils::CSerializable
28  * \ingroup mrpt_maps_grp
29  */
30 class CColouredPointsMap : public CPointsMap
31 {
33 
34  public:
35  /** Destructor
36  */
37  virtual ~CColouredPointsMap();
38 
39  /** Default constructor
40  */
42 
43  // --------------------------------------------
44  /** @name Pure virtual interfaces to be implemented by any class derived
45  from CPointsMap
46  @{ */
47 
48  virtual void reserve(size_t newLength) override; // See base class docs
49  virtual void resize(size_t newLength) override; // See base class docs
50  virtual void setSize(size_t newLength) override; // See base class docs
51 
52  /** Changes the coordinates of the given point (0-based index), *without*
53  * checking for out-of-bounds and *without* calling mark_as_modified() \sa
54  * setPoint */
55  virtual void setPointFast(size_t index, float x, float y, float z) override
56  {
57  this->x[index] = x;
58  this->y[index] = y;
59  this->z[index] = z;
60  }
61 
62  /** The virtual method for \a insertPoint() *without* calling
63  * mark_as_modified() */
64  virtual void insertPointFast(float x, float y, float z = 0) override;
65 
66  /** Virtual assignment operator, to be implemented in derived classes */
67  virtual void copyFrom(const CPointsMap& obj) override;
68 
69  /** Get all the data fields for one point as a vector: [X Y Z R G B]
70  * Unlike getPointAllFields(), this method does not check for index out of
71  * bounds
72  * \sa getPointAllFields, setPointAllFields, setPointAllFieldsFast
73  */
74  virtual void getPointAllFieldsFast(
75  const size_t index, std::vector<float>& point_data) const override
76  {
77  point_data.resize(6);
78  point_data[0] = x[index];
79  point_data[1] = y[index];
80  point_data[2] = z[index];
81  point_data[3] = m_color_R[index];
82  point_data[4] = m_color_G[index];
83  point_data[5] = m_color_B[index];
84  }
85 
86  /** Set all the data fields for one point as a vector: [X Y Z R G B]
87  * Unlike setPointAllFields(), this method does not check for index out of
88  * bounds
89  * \sa setPointAllFields, getPointAllFields, getPointAllFieldsFast
90  */
91  virtual void setPointAllFieldsFast(
92  const size_t index, const std::vector<float>& point_data) override
93  {
94  ASSERTDEB_(point_data.size() == 6)
95  x[index] = point_data[0];
96  y[index] = point_data[1];
97  z[index] = point_data[2];
98  m_color_R[index] = point_data[3];
99  m_color_G[index] = point_data[4];
100  m_color_B[index] = point_data[5];
101  }
103  /** See CPointsMap::loadFromRangeScan() */
104  virtual void loadFromRangeScan(
105  const mrpt::obs::CObservation2DRangeScan& rangeScan,
106  const mrpt::poses::CPose3D* robotPose = nullptr) override;
107  /** See CPointsMap::loadFromRangeScan() */
108  virtual void loadFromRangeScan(
110  const mrpt::poses::CPose3D* robotPose = nullptr) override;
111 
112  protected:
113  /** Auxiliary method called from within \a addFrom() automatically, to
114  * finish the copying of class-specific data */
115  virtual void addFrom_classSpecific(
116  const CPointsMap& anotherMap, const size_t nPreviousPoints) override;
117 
118  // Friend methods:
119  template <class Derived>
121  template <class Derived>
122  friend struct detail::pointmap_traits;
123 
124  public:
125  /** @} */
126  // --------------------------------------------
127 
128  /** Save to a text file. In each line contains X Y Z (meters) R G B (range
129  * [0,1]) for each point in the map.
130  * Returns false if any error occured, true elsewere.
131  */
132  bool save3D_and_colour_to_text_file(const std::string& file) const;
133 
134  /** Changes a given point from map. First index is 0.
135  * \exception Throws std::exception on index out of bound.
136  */
137  virtual void setPoint(
138  size_t index, float x, float y, float z, float R, float G,
139  float B) override;
141  // The following overloads must be repeated here (from CPointsMap) due to
142  // the shadowing of the above "setPoint()"
143  /// \overload
144  inline void setPoint(size_t index, float x, float y, float z)
145  {
146  ASSERT_BELOW_(index, this->size())
147  setPointFast(index, x, y, z);
149  }
150  /// \overload
151  inline void setPoint(size_t index, mrpt::math::TPoint3Df& p)
152  {
153  setPoint(index, p.x, p.y, p.z);
154  }
155  /// \overload
156  inline void setPoint(size_t index, float x, float y)
157  {
158  setPoint(index, x, y, 0);
159  }
161  /** Adds a new point given its coordinates and color (colors range is [0,1])
162  */
163  virtual void insertPoint(
164  float x, float y, float z, float R, float G, float B) override;
165  // The following overloads must be repeated here (from CPointsMap) due to
166  // the shadowing of the above "insertPoint()"
167  /// \overload
168  inline void insertPoint(const mrpt::poses::CPoint3D& p)
169  {
170  insertPoint(p.x(), p.y(), p.z());
171  }
172  /// \overload
173  inline void insertPoint(const mrpt::math::TPoint3D& p)
174  {
175  insertPoint(p.x, p.y, p.z);
176  }
177  /// \overload
178  inline void insertPoint(const mrpt::math::TPoint3Df& p)
179  {
180  insertPoint(p.x, p.y, p.z);
181  }
182  /// \overload
183  inline void insertPoint(float x, float y, float z)
184  {
185  insertPointFast(x, y, z);
187  }
188 
189  /** Changes just the color of a given point from the map. First index is 0.
190  * \exception Throws std::exception on index out of bound.
191  */
192  void setPointColor(size_t index, float R, float G, float B);
193 
194  /** Like \c setPointColor but without checking for out-of-index erors */
195  inline void setPointColor_fast(size_t index, float R, float G, float B)
196  {
197  this->m_color_R[index] = R;
198  this->m_color_G[index] = G;
199  this->m_color_B[index] = B;
200  }
201 
202  /** Retrieves a point and its color (colors range is [0,1])
203  */
204  virtual void getPoint(
205  size_t index, float& x, float& y, float& z, float& R, float& G,
206  float& B) const override;
207 
208  /** Retrieves a point */
209  unsigned long getPoint(size_t index, float& x, float& y, float& z) const;
210 
211  /** Retrieves a point color (colors range is [0,1]) */
212  void getPointColor(size_t index, float& R, float& G, float& B) const;
213 
214  /** Like \c getPointColor but without checking for out-of-index erors */
215  inline void getPointColor_fast(
216  size_t index, float& R, float& G, float& B) const
217  {
218  R = m_color_R[index];
219  G = m_color_G[index];
221  }
222 
223  /** Returns true if the point map has a color field for each point */
224  virtual bool hasColorPoints() const override { return true; }
225  /** Override of the default 3D scene builder to account for the individual
226  * points' color.
227  * \sa mrpt::global_settings::POINTSMAPS_3DOBJECT_POINTSIZE
228  */
229  virtual void getAs3DObject(
230  mrpt::opengl::CSetOfObjects::Ptr& outObj) const override;
231 
232  /** Colour a set of points from a CObservationImage and the global pose of
233  * the robot */
235  const mrpt::obs::CObservationImage& obs,
236  const mrpt::poses::CPose3D& robotPose);
237 
238  /** The choices for coloring schemes:
239  * - cmFromHeightRelativeToSensor: The Z coordinate wrt the sensor will
240  *be
241  *used to obtain the color using the limits z_min,z_max.
242  * - cmFromIntensityImage: When inserting 3D range scans, take the
243  *color
244  *from the intensity image channel, if available.
245  * \sa TColourOptions
246  */
248  {
253  // Remember: if new values are added, also update TEnumType below!
254  };
255 
256  /** The definition of parameters for generating colors from laser scans */
258  {
259  /** Initilization of default parameters */
260  TColourOptions();
261  virtual ~TColourOptions() {}
262  void loadFromConfigFile(
264  const std::string& section) override; // See base docs
266  mrpt::utils::CStream& out) const override; // See base docs
267 
269  float z_min, z_max;
270  float d_max;
271  };
272 
273  /** The options employed when inserting laser scans in the map. */
275 
276  /** Reset the minimum-observed-distance buffer for all the points to a
277  * predefined value */
278  void resetPointsMinDist(float defValue = 2000.0f);
280  /** @name PCL library support
281  @{ */
283  /** Save the point cloud as a PCL PCD file, in either ASCII or binary format
284  * \return false on any error */
285  virtual bool savePCDFile(
286  const std::string& filename, bool save_as_binary) const override;
288  /** Loads a PCL point cloud (WITH RGB information) into this MRPT class (for
289  * clouds without RGB data, see CPointsMap::setFromPCLPointCloud() ).
290  * Usage example:
291  * \code
292  * pcl::PointCloud<pcl::PointXYZRGB> cloud;
293  * mrpt::maps::CColouredPointsMap pc;
294  *
295  * pc.setFromPCLPointCloudRGB(cloud);
296  * \endcode
297  * \sa CPointsMap::setFromPCLPointCloud()
298  */
299  template <class POINTCLOUD>
300  void setFromPCLPointCloudRGB(const POINTCLOUD& cloud)
301  {
302  const size_t N = cloud.points.size();
303  clear();
304  reserve(N);
305  const float f = 1.0f / 255.0f;
306  for (size_t i = 0; i < N; ++i)
307  this->insertPoint(
308  cloud.points[i].x, cloud.points[i].y, cloud.points[i].z,
309  cloud.points[i].r * f, cloud.points[i].g * f,
310  cloud.points[i].b * f);
311  }
312 
313  /** Like CPointsMap::getPCLPointCloud() but for PointCloud<PointXYZRGB> */
314  template <class POINTCLOUD>
315  void getPCLPointCloudXYZRGB(POINTCLOUD& cloud) const
316  {
317  const size_t nThis = this->size();
318  this->getPCLPointCloud(cloud); // 1st: xyz data
319  // 2nd: RGB data
320  for (size_t i = 0; i < nThis; ++i)
321  {
322  float R, G, B;
323  this->getPointColor_fast(i, R, G, B);
324  cloud.points[i].r = static_cast<uint8_t>(R * 255);
325  cloud.points[i].g = static_cast<uint8_t>(G * 255);
326  cloud.points[i].b = static_cast<uint8_t>(B * 255);
327  }
328  }
329  /** @} */
330 
331  protected:
332  /** The color data */
333  std::vector<float> m_color_R, m_color_G, m_color_B;
335  /** Minimum distance from where the points have been seen */
336  // std::vector<float> m_min_dist;
337 
338  /** Clear the map, erasing all the points */
339  virtual void internal_clear() override;
340 
341  /** @name Redefinition of PLY Import virtual methods from CPointsMap
342  @{ */
343  /** In a base class, will be called after PLY_import_set_vertex_count() once
344  * for each loaded point.
345  * \param pt_color Will be nullptr if the loaded file does not provide
346  * color info.
347  */
348  virtual void PLY_import_set_vertex(
349  const size_t idx, const mrpt::math::TPoint3Df& pt,
350  const mrpt::utils::TColorf* pt_color = nullptr) override;
351 
352  /** In a base class, reserve memory to prepare subsequent calls to
353  * PLY_import_set_vertex */
354  virtual void PLY_import_set_vertex_count(const size_t N) override;
355  /** @} */
357  /** @name Redefinition of PLY Export virtual methods from CPointsMap
358  @{ */
360  const size_t idx, mrpt::math::TPoint3Df& pt, bool& pt_has_color,
361  mrpt::utils::TColorf& pt_color) const override;
362  /** @} */
363 
365  mrpt::maps::CPointsMap::TInsertionOptions insertionOpts;
366  mrpt::maps::CPointsMap::TLikelihoodOptions likelihoodOpts;
369 
370 }; // End of class def.
371 
372 } // End of namespace
373 
374 #include <mrpt/utils/adapters.h>
375 namespace utils
376 {
377 /** Specialization
378  * mrpt::utils::PointCloudAdapter<mrpt::maps::CColouredPointsMap> \ingroup
379  * mrpt_adapters_grp */
380 template <>
382 {
383  private:
385 
386  public:
387  /** The type of each point XYZ coordinates */
388  typedef float coords_t;
389  /** Has any color RGB info? */
390  static const int HAS_RGB = 1;
391  /** Has native RGB info (as floats)? */
392  static const int HAS_RGBf = 1;
393  /** Has native RGB info (as uint8_t)? */
394  static const int HAS_RGBu8 = 0;
395 
396  /** Constructor (accept a const ref for convenience) */
398  : m_obj(*const_cast<mrpt::maps::CColouredPointsMap*>(&obj))
399  {
400  }
401  /** Get number of points */
402  inline size_t size() const { return m_obj.size(); }
403  /** Set number of points (to uninitialized values) */
404  inline void resize(const size_t N) { m_obj.resize(N); }
405  /** Get XYZ coordinates of i'th point */
406  template <typename T>
407  inline void getPointXYZ(const size_t idx, T& x, T& y, T& z) const
408  {
409  m_obj.getPointFast(idx, x, y, z);
410  }
411  /** Set XYZ coordinates of i'th point */
412  inline void setPointXYZ(
413  const size_t idx, const coords_t x, const coords_t y, const coords_t z)
414  {
415  m_obj.setPointFast(idx, x, y, z);
416  }
417 
418  /** Get XYZ_RGBf coordinates of i'th point */
419  template <typename T>
420  inline void getPointXYZ_RGBf(
421  const size_t idx, T& x, T& y, T& z, float& r, float& g, float& b) const
422  {
423  m_obj.getPoint(idx, x, y, z, r, g, b);
424  }
425  /** Set XYZ_RGBf coordinates of i'th point */
426  inline void setPointXYZ_RGBf(
427  const size_t idx, const coords_t x, const coords_t y, const coords_t z,
428  const float r, const float g, const float b)
429  {
430  m_obj.setPoint(idx, x, y, z, r, g, b);
431  }
433  /** Get XYZ_RGBu8 coordinates of i'th point */
434  template <typename T>
435  inline void getPointXYZ_RGBu8(
436  const size_t idx, T& x, T& y, T& z, uint8_t& r, uint8_t& g,
437  uint8_t& b) const
438  {
439  float Rf, Gf, Bf;
440  m_obj.getPoint(idx, x, y, z, Rf, Gf, Bf);
441  r = Rf * 255;
442  g = Gf * 255;
443  b = Bf * 255;
444  }
445  /** Set XYZ_RGBu8 coordinates of i'th point */
446  inline void setPointXYZ_RGBu8(
447  const size_t idx, const coords_t x, const coords_t y, const coords_t z,
448  const uint8_t r, const uint8_t g, const uint8_t b)
449  {
450  m_obj.setPoint(idx, x, y, z, r / 255.f, g / 255.f, b / 255.f);
451  }
452 
453  /** Get RGBf color of i'th point */
454  inline void getPointRGBf(
455  const size_t idx, float& r, float& g, float& b) const
456  {
457  m_obj.getPointColor_fast(idx, r, g, b);
458  }
459  /** Set XYZ_RGBf coordinates of i'th point */
460  inline void setPointRGBf(
461  const size_t idx, const float r, const float g, const float b)
462  {
463  m_obj.setPointColor_fast(idx, r, g, b);
464  }
465 
466  /** Get RGBu8 color of i'th point */
467  inline void getPointRGBu8(
468  const size_t idx, uint8_t& r, uint8_t& g, uint8_t& b) const
469  {
470  float R, G, B;
471  m_obj.getPointColor_fast(idx, R, G, B);
472  r = R * 255;
473  g = G * 255;
474  b = B * 255;
475  }
476  /** Set RGBu8 coordinates of i'th point */
477  inline void setPointRGBu8(
478  const size_t idx, const uint8_t r, const uint8_t g, const uint8_t b)
479  {
480  m_obj.setPointColor_fast(idx, r / 255.f, g / 255.f, b / 255.f);
481  }
483 }; // end of PointCloudAdapter<mrpt::maps::CColouredPointsMap>
485 template <>
487 {
489  static void fill(bimap<enum_t, std::string>& m_map)
490  {
491  using namespace mrpt::maps;
498  }
499 };
500 } // End of namespace
501 } // End of namespace
502 #endif
void clear()
Erase all the contents of the map.
Definition: CMetricMap.cpp:31
std::vector< float > y
Definition: CPointsMap.h:1076
virtual void getPoint(size_t index, float &x, float &y, float &z, float &R, float &G, float &B) const override
Retrieves a point and its color (colors range is [0,1])
void getPointXYZ_RGBf(const size_t idx, T &x, T &y, T &z, float &r, float &g, float &b) const
Get XYZ_RGBf coordinates of i&#39;th point.
virtual void setSize(size_t newLength) override
Resizes all point buffers so they can hold the given number of points, erasing all previous contents ...
virtual void addFrom_classSpecific(const CPointsMap &anotherMap, const size_t nPreviousPoints) override
Auxiliary method called from within addFrom() automatically, to finish the copying of class-specific ...
TColouringMethod
The choices for coloring schemes:
Declares a class derived from "CObservation" that encapsules an image from a camera, whose relative pose to robot is also stored.
void getPointFast(size_t index, float &x, float &y, float &z) const
Just like getPoint() but without checking out-of-bound index and without returning the point weight...
Definition: CPointsMap.h:427
#define MAP_DEFINITION_END(_CLASS_NAME_, _LINKAGE_)
GLdouble GLdouble z
Definition: glext.h:3872
virtual void insertPointFast(float x, float y, float z=0) override
The virtual method for insertPoint() without calling mark_as_modified()
bool save3D_and_colour_to_text_file(const std::string &file) const
Save to a text file.
void setPointRGBu8(const size_t idx, const uint8_t r, const uint8_t g, const uint8_t b)
Set RGBu8 coordinates of i&#39;th point.
void setPointXYZ_RGBu8(const size_t idx, const coords_t x, const coords_t y, const coords_t z, const uint8_t r, const uint8_t g, const uint8_t b)
Set XYZ_RGBu8 coordinates of i&#39;th point.
TColourOptions()
Initilization of default parameters.
virtual void internal_clear() override
Minimum distance from where the points have been seen.
#define MAP_DEFINITION_START(_CLASS_NAME_)
Add a MAP_DEFINITION_START() ...
void insertPoint(float x, float y, float z)
Declares a class derived from "CObservation" that encapsules a 3D range scan measurement, as from a time-of-flight range camera or any other RGBD sensor.
#define ASSERT_BELOW_(__A, __B)
void setPointColor_fast(size_t index, float R, float G, float B)
Like setPointColor but without checking for out-of-index erors.
void setFromPCLPointCloudRGB(const POINTCLOUD &cloud)
Loads a PCL point cloud (WITH RGB information) into this MRPT class (for clouds without RGB data...
GLsizei GLsizei GLuint * obj
Definition: glext.h:4070
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source, const std::string &section) override
This method load the options from a ".ini"-like file or memory-stored string list.
#define MRPT_FILL_ENUM_MEMBER(_CLASS, _VALUE)
Definition: TEnumType.h:32
TColourOptions colorScheme
The options employed when inserting laser scans in the map.
void getPointXYZ(const size_t idx, T &x, T &y, T &z) const
Get XYZ coordinates of i&#39;th point.
This class allows loading and storing values and vectors of different types from a configuration text...
virtual void reserve(size_t newLength) override
Reserves memory for a given number of points: the size of the map does not change, it only reserves the memory.
CColouredPointsMap()
Default constructor.
unsigned char uint8_t
Definition: rptypes.h:41
With this struct options are provided to the observation insertion process.
Definition: CPointsMap.h:204
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
Definition: CStream.h:41
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans or other sensors...
Definition: CPointsMap.h:63
virtual bool hasColorPoints() const override
Returns true if the point map has a color field for each point.
void getPointXYZ_RGBu8(const size_t idx, T &x, T &y, T &z, uint8_t &r, uint8_t &g, uint8_t &b) const
Get XYZ_RGBu8 coordinates of i&#39;th point.
void dumpToTextStream(mrpt::utils::CStream &out) const override
This method should clearly display all the contents of the structure in textual form, sending it to a CStream.
Lightweight 3D point (float version).
GLuint index
Definition: glext.h:4054
std::vector< float > z
Definition: CPointsMap.h:1076
virtual void PLY_import_set_vertex(const size_t idx, const mrpt::math::TPoint3Df &pt, const mrpt::utils::TColorf *pt_color=nullptr) override
In a base class, will be called after PLY_import_set_vertex_count() once for each loaded point...
A bidirectional version of std::map, declared as bimap<KEY,VALUE> and which actually contains two std...
Definition: bimap.h:34
void PLY_export_get_vertex(const size_t idx, mrpt::math::TPoint3Df &pt, bool &pt_has_color, mrpt::utils::TColorf &pt_color) const override
In a base class, will be called after PLY_export_get_vertex_count() once for each exported point...
std::shared_ptr< CSetOfObjects > Ptr
Definition: CSetOfObjects.h:32
GLubyte g
Definition: glext.h:6279
GLubyte GLubyte b
Definition: glext.h:6279
virtual void PLY_import_set_vertex_count(const size_t N) override
In a base class, reserve memory to prepare subsequent calls to PLY_import_set_vertex.
virtual void setPointFast(size_t index, float x, float y, float z) override
Changes the coordinates of the given point (0-based index), without checking for out-of-bounds and wi...
void insertPoint(const mrpt::math::TPoint3Df &p)
virtual void copyFrom(const CPointsMap &obj) override
Virtual assignment operator, to be implemented in derived classes.
void getPCLPointCloud(POINTCLOUD &cloud) const
Use to convert this MRPT point cloud object into a PCL point cloud object (PointCloud<PointXYZ>).
Definition: CPointsMap.h:963
virtual bool savePCDFile(const std::string &filename, bool save_as_binary) const override
Save the point cloud as a PCL PCD file, in either ASCII or binary format.
void getPointRGBu8(const size_t idx, uint8_t &r, uint8_t &g, uint8_t &b) const
Get RGBu8 color of i&#39;th point.
A map of 2D/3D points with individual colours (RGB).
std::vector< float > x
The point coordinates.
Definition: CPointsMap.h:1076
GLsizei const GLchar ** string
Definition: glext.h:4101
A class used to store a 3D point.
Definition: CPoint3D.h:32
void getPCLPointCloudXYZRGB(POINTCLOUD &cloud) const
Like CPointsMap::getPCLPointCloud() but for PointCloud<PointXYZRGB>
void setPoint(size_t index, float x, float y, float z)
void setPointRGBf(const size_t idx, const float r, const float g, const float b)
Set XYZ_RGBf coordinates of i&#39;th point.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
void mark_as_modified() const
Users normally don&#39;t need to call this.
Definition: CPointsMap.h:1067
GLdouble GLdouble GLdouble r
Definition: glext.h:3705
const float R
PointCloudAdapter(const mrpt::maps::CColouredPointsMap &obj)
Constructor (accept a const ref for convenience)
virtual void setPoint(size_t index, float x, float y, float z, float R, float G, float B) override
Changes a given point from map.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Definition: CPose3D.h:88
void resetPointsMinDist(float defValue=2000.0f)
Reset the minimum-observed-distance buffer for all the points to a predefined value.
virtual void getPointAllFieldsFast(const size_t index, std::vector< float > &point_data) const override
Get all the data fields for one point as a vector: [X Y Z R G B] Unlike getPointAllFields(), this method does not check for index out of bounds.
virtual void loadFromRangeScan(const mrpt::obs::CObservation2DRangeScan &rangeScan, const mrpt::poses::CPose3D *robotPose=nullptr) override
See CPointsMap::loadFromRangeScan()
virtual void setPointAllFieldsFast(const size_t index, const std::vector< float > &point_data) override
Set all the data fields for one point as a vector: [X Y Z R G B] Unlike setPointAllFields(), this method does not check for index out of bounds.
virtual void resize(size_t newLength) override
Resizes all point buffers so they can hold the given number of points: newly created points are set t...
GLsizei GLsizei GLchar * source
Definition: glext.h:4082
void resize(const size_t N)
Set number of points (to uninitialized values)
A RGB color - floats in the range [0,1].
Definition: TColor.h:78
GLenum GLint GLint y
Definition: glext.h:3538
std::vector< float > m_color_R
The color data.
void setPointXYZ(const size_t idx, const coords_t x, const coords_t y, const coords_t z)
Set XYZ coordinates of i&#39;th point.
The definition of parameters for generating colors from laser scans.
virtual void insertPoint(float x, float y, float z, float R, float G, float B) override
Adds a new point given its coordinates and color (colors range is [0,1])
An adapter to different kinds of point cloud object.
Definition: adapters.h:41
virtual void getAs3DObject(mrpt::opengl::CSetOfObjects::Ptr &outObj) const override
Override of the default 3D scene builder to account for the individual points&#39; color.
GLenum GLint x
Definition: glext.h:3538
Lightweight 3D point.
bool colourFromObservation(const mrpt::obs::CObservationImage &obs, const mrpt::poses::CPose3D &robotPose)
Colour a set of points from a CObservationImage and the global pose of the robot. ...
size_t size() const
Returns the number of stored points in the map.
Definition: CPointsMap.h:385
GLfloat GLfloat p
Definition: glext.h:6305
#define ASSERTDEB_(f)
void getPointColor_fast(size_t index, float &R, float &G, float &B) const
Like getPointColor but without checking for out-of-index erors.
void getPointColor(size_t index, float &R, float &G, float &B) const
Retrieves a point color (colors range is [0,1])
This is a virtual base class for sets of options than can be loaded from and/or saved to configuratio...
float coords_t
The type of each point XYZ coordinates.
void setPointColor(size_t index, float R, float G, float B)
Changes just the color of a given point from the map.



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019