9 #ifndef mrpt_maps_PCL_adapters_H    10 #define mrpt_maps_PCL_adapters_H    12 #include <mrpt/config.h>    19 #include <pcl/point_types.h>    20 #include <pcl/point_cloud.h>    31                         pcl::PointCloud<pcl::PointXYZ> &
m_obj;
    34                         static const int HAS_RGB   = 0;  
    35                         static const int HAS_RGBf  = 0;  
    36                         static const int HAS_RGBu8 = 0;  
    39                         inline PointCloudAdapter(
const pcl::PointCloud<pcl::PointXYZ> &
obj) : m_obj(*const_cast<pcl::PointCloud<pcl::PointXYZ>*>(&
obj)) { }
    41                         inline size_t size()
 const { 
return m_obj.points.size(); }
    43                         inline void resize(
const size_t N) { m_obj.points.resize(N); }
    48                                 const pcl::PointXYZ &
p=m_obj.points[idx];
    53                                 pcl::PointXYZ &
p=m_obj.points[idx];
    60                                 pcl::PointXYZ &
p=m_obj.points[idx];
    61                                 p.x = 
p.y = 
p.z = std::numeric_limits<float>::quiet_NaN();
    71                         pcl::PointCloud<pcl::PointXYZRGB> &
m_obj;
    74                         static const int HAS_RGB   = 1;  
    75                         static const int HAS_RGBf  = 0;  
    76                         static const int HAS_RGBu8 = 1;  
    79                         inline PointCloudAdapter(
const pcl::PointCloud<pcl::PointXYZRGB> &
obj) : m_obj(*const_cast<pcl::PointCloud<pcl::PointXYZRGB>*>(&
obj)) { }
    81                         inline size_t size()
 const { 
return m_obj.points.size(); }
    83                         inline void resize(
const size_t N) { m_obj.points.resize(N); }
    88                                 const pcl::PointXYZRGB &
p=m_obj.points[idx];
    93                                 pcl::PointXYZRGB &
p=m_obj.points[idx];
   101                                 const pcl::PointXYZRGB &
p=m_obj.points[idx];
   103                                 r=
p.r/255.f; 
g=
p.g/255.f; 
b=
p.b/255.f;
   107                                 pcl::PointXYZRGB &
p=m_obj.points[idx];
   109                                 p.r=
r*255; 
p.g=
g*255; 
p.b=
b*255;
   113                         template <
typename T>
   115                                 const pcl::PointXYZRGB &
p=m_obj.points[idx];
   121                                 pcl::PointXYZRGB &
p=m_obj.points[idx];
   128                                 const pcl::PointXYZRGB &
p=m_obj.points[idx];
   129                                 r=
p.r/255.f; 
g=
p.g/255.f; 
b=
p.b/255.f;
   132                         inline void setPointRGBf(
const size_t idx, 
const float r,
const float g,
const float b) {
   133                                 pcl::PointXYZRGB &
p=m_obj.points[idx];
   134                                 p.r=
r*255; 
p.g=
g*255; 
p.b=
b*255;
   139                                 const pcl::PointXYZRGB &
p=m_obj.points[idx];
   144                                 pcl::PointXYZRGB &
p=m_obj.points[idx];
   157                         pcl::PointCloud<pcl::PointXYZRGBA> &
m_obj;
   160                         static const int HAS_RGB   = 1;  
   161                         static const int HAS_RGBf  = 0;  
   162                         static const int HAS_RGBu8 = 1;  
   165                         inline PointCloudAdapter(
const pcl::PointCloud<pcl::PointXYZRGBA> &
obj) : m_obj(*const_cast<pcl::PointCloud<pcl::PointXYZRGBA>*>(&
obj)) { }
   167                         inline size_t size()
 const { 
return m_obj.points.size(); }
   169                         inline void resize(
const size_t N) { m_obj.points.resize(N); }
   172                         template <
typename T>
   174                                 const pcl::PointXYZRGBA &
p=m_obj.points[idx];
   179                                 pcl::PointXYZRGBA &
p=m_obj.points[idx];
   187                                 pcl::PointXYZRGBA &
p=m_obj.points[idx];
   188                                 p.x = 
p.y = 
p.z = std::numeric_limits<float>::quiet_NaN();
   192                         template <
typename T>
   194                                 const pcl::PointXYZRGBA &
p=m_obj.points[idx];
   196                                 r=
p.r/255.f; 
g=
p.g/255.f; 
b=
p.b/255.f;
   200                                 pcl::PointXYZRGBA &
p=m_obj.points[idx];
   202                                 p.r=
r*255; 
p.g=
g*255; 
p.b=
b*255;
   206                         template <
typename T>
   208                                 const pcl::PointXYZRGBA &
p=m_obj.points[idx];
   214                                 pcl::PointXYZRGBA &
p=m_obj.points[idx];
   221                                 const pcl::PointXYZRGBA &
p=m_obj.points[idx];
   222                                 r=
p.r/255.f; 
g=
p.g/255.f; 
b=
p.b/255.f;
   225                         inline void setPointRGBf(
const size_t idx, 
const float r,
const float g,
const float b) {
   226                                 pcl::PointXYZRGBA &
p=m_obj.points[idx];
   227                                 p.r=
r*255; 
p.g=
g*255; 
p.b=
b*255;
   232                                 const pcl::PointXYZRGBA &
p=m_obj.points[idx];
   237                                 pcl::PointXYZRGBA &
p=m_obj.points[idx];
 pcl::PointCloud< pcl::PointXYZ > & m_obj
 
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'th point. 
 
void resize(const size_t N)
Set number of points (to uninitialized values) 
 
float coords_t
The type of each point XYZ coordinates. 
 
void getPointRGBf(const size_t idx, float &r, float &g, float &b) const
Get RGBf color of i'th point. 
 
A helper base class for those PointCloudAdapter<> which do not handle RGB data; it declares needed in...
 
void getPointXYZ(const size_t idx, T &x, T &y, T &z) const
Get XYZ coordinates of i'th point. 
 
void getPointXYZ(const size_t idx, T &x, T &y, T &z) const
Get XYZ coordinates of i'th point. 
 
float coords_t
The type of each point XYZ coordinates. 
 
void setPointXYZ(const size_t idx, const coords_t x, const coords_t y, const coords_t z)
Set XYZ coordinates of i'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'th point. 
 
void resize(const size_t N)
Set number of points (to uninitialized values) 
 
PointCloudAdapter(const pcl::PointCloud< pcl::PointXYZRGB > &obj)
Constructor (accept a const ref for convenience) 
 
void setInvalidPoint(const size_t idx)
Set Invalid Point. 
 
GLsizei GLsizei GLuint * obj
 
void setInvalidPoint(const size_t idx)
Set Invalid Point. 
 
size_t size() const
Get number of points. 
 
void getPointRGBu8(const size_t idx, uint8_t &r, uint8_t &g, uint8_t &b) const
Get RGBu8 color of i'th point. 
 
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'th point. 
 
void getPointRGBu8(const size_t idx, uint8_t &r, uint8_t &g, uint8_t &b) const
Get RGBu8 color of i'th point. 
 
PointCloudAdapter(const pcl::PointCloud< pcl::PointXYZ > &obj)
Constructor (accept a const ref for convenience) 
 
void setPointRGBf(const size_t idx, const float r, const float g, const float b)
Set XYZ_RGBf coordinates of i'th point. 
 
void setPointXYZ_RGBf(const size_t idx, const coords_t x, const coords_t y, const coords_t z, const float r, const float g, const float b)
Set XYZ_RGBf coordinates of i'th point. 
 
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries. 
 
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'th point. 
 
size_t size() const
Get number of points. 
 
GLdouble GLdouble GLdouble r
 
void resize(const size_t N)
Set number of points (to uninitialized values) 
 
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'th point. 
 
pcl::PointCloud< pcl::PointXYZRGBA > & m_obj
 
void setPointXYZ_RGBf(const size_t idx, const coords_t x, const coords_t y, const coords_t z, const float r, const float g, const float b)
Set XYZ_RGBf coordinates of i'th point. 
 
PointCloudAdapter(const pcl::PointCloud< pcl::PointXYZRGBA > &obj)
Constructor (accept a const ref for convenience) 
 
void setPointXYZ(const size_t idx, const coords_t x, const coords_t y, const coords_t z)
Set XYZ coordinates of i'th point. 
 
size_t size() const
Get number of points. 
 
void setPointRGBu8(const size_t idx, const uint8_t r, const uint8_t g, const uint8_t b)
Set RGBu8 coordinates of i'th point. 
 
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'th point. 
 
An adapter to different kinds of point cloud object. 
 
void setPointXYZ(const size_t idx, const coords_t x, const coords_t y, const coords_t z)
Set XYZ coordinates of i'th point. 
 
void getPointRGBf(const size_t idx, float &r, float &g, float &b) const
Get RGBf color of i'th point. 
 
pcl::PointCloud< pcl::PointXYZRGB > & m_obj
 
void setPointRGBu8(const size_t idx, const uint8_t r, const uint8_t g, const uint8_t b)
Set RGBu8 coordinates of i'th point. 
 
float coords_t
The type of each point XYZ coordinates. 
 
void setPointRGBf(const size_t idx, const float r, const float g, const float b)
Set XYZ_RGBf coordinates of i'th point. 
 
void getPointXYZ(const size_t idx, T &x, T &y, T &z) const
Get XYZ coordinates of i'th point.