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>, float>
    34         pcl::PointCloud<pcl::PointXYZ>& 
m_obj;
    40         static const int HAS_RGB = 0;
    42         static const int HAS_RGBf = 0;
    44         static const int HAS_RGBu8 = 0;
    48                 : m_obj(*const_cast<pcl::PointCloud<pcl::PointXYZ>*>(&
obj))
    52         inline size_t size()
 const { 
return m_obj.points.size(); }
    54         inline void resize(
const size_t N) { m_obj.points.resize(N); }
    59                 const pcl::PointXYZ& 
p = m_obj.points[idx];
    68                 pcl::PointXYZ& 
p = m_obj.points[idx];
    77                 pcl::PointXYZ& 
p = m_obj.points[idx];
    78                 p.x = 
p.y = 
p.z = std::numeric_limits<float>::quiet_NaN();
    89         pcl::PointCloud<pcl::PointXYZRGB>& 
m_obj;
    95         static const int HAS_RGB = 1;
    97         static const int HAS_RGBf = 0;
    99         static const int HAS_RGBu8 = 1;
   103                 : m_obj(*const_cast<pcl::PointCloud<pcl::PointXYZRGB>*>(&
obj))
   107         inline size_t size()
 const { 
return m_obj.points.size(); }
   109         inline void resize(
const size_t N) { m_obj.points.resize(N); }
   111         template <
typename T>
   114                 const pcl::PointXYZRGB& 
p = m_obj.points[idx];
   123                 pcl::PointXYZRGB& 
p = m_obj.points[idx];
   127                 p.r = 
p.g = 
p.b = 255;
   131         template <
typename T>
   133                 const size_t idx, T& 
x, T& 
y, T& 
z, 
float& 
r, 
float& 
g, 
float& 
b)
 const   135                 const pcl::PointXYZRGB& 
p = m_obj.points[idx];
   146                 const float r, 
const float g, 
const float b)
   148                 pcl::PointXYZRGB& 
p = m_obj.points[idx];
   158         template <
typename T>
   163                 const pcl::PointXYZRGB& 
p = m_obj.points[idx];
   176                 pcl::PointXYZRGB& 
p = m_obj.points[idx];
   187                 const size_t idx, 
float& 
r, 
float& 
g, 
float& 
b)
 const   189                 const pcl::PointXYZRGB& 
p = m_obj.points[idx];
   196                 const size_t idx, 
const float r, 
const float g, 
const float b)
   198                 pcl::PointXYZRGB& 
p = m_obj.points[idx];
   208                 const pcl::PointXYZRGB& 
p = m_obj.points[idx];
   217                 pcl::PointXYZRGB& 
p = m_obj.points[idx];
   232         pcl::PointCloud<pcl::PointXYZRGBA>& 
m_obj;
   238         static const int HAS_RGB = 1;
   240         static const int HAS_RGBf = 0;
   242         static const int HAS_RGBu8 = 1;
   246                 : m_obj(*const_cast<pcl::PointCloud<pcl::PointXYZRGBA>*>(&
obj))
   250         inline size_t size()
 const { 
return m_obj.points.size(); }
   252         inline void resize(
const size_t N) { m_obj.points.resize(N); }
   254         template <
typename T>
   257                 const pcl::PointXYZRGBA& 
p = m_obj.points[idx];
   266                 pcl::PointXYZRGBA& 
p = m_obj.points[idx];
   270                 p.r = 
p.g = 
p.b = 255;
   276                 pcl::PointXYZRGBA& 
p = m_obj.points[idx];
   277                 p.x = 
p.y = 
p.z = std::numeric_limits<float>::quiet_NaN();
   281         template <
typename T>
   283                 const size_t idx, T& 
x, T& 
y, T& 
z, 
float& 
r, 
float& 
g, 
float& 
b)
 const   285                 const pcl::PointXYZRGBA& 
p = m_obj.points[idx];
   296                 const float r, 
const float g, 
const float b)
   298                 pcl::PointXYZRGBA& 
p = m_obj.points[idx];
   308         template <
typename T>
   313                 const pcl::PointXYZRGBA& 
p = m_obj.points[idx];
   326                 pcl::PointXYZRGBA& 
p = m_obj.points[idx];
   337                 const size_t idx, 
float& 
r, 
float& 
g, 
float& 
b)
 const   339                 const pcl::PointXYZRGBA& 
p = m_obj.points[idx];
   346                 const size_t idx, 
const float r, 
const float g, 
const float b)
   348                 pcl::PointXYZRGBA& 
p = m_obj.points[idx];
   358                 const pcl::PointXYZRGBA& 
p = m_obj.points[idx];
   367                 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.