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> 30 pcl::PointCloud<pcl::PointXYZ>, float>
33 pcl::PointCloud<pcl::PointXYZ>&
m_obj;
39 static const int HAS_RGB = 0;
41 static const int HAS_RGBf = 0;
43 static const int HAS_RGBu8 = 0;
47 : m_obj(*const_cast<pcl::PointCloud<pcl::PointXYZ>*>(&
obj))
51 inline size_t size()
const {
return m_obj.points.size(); }
53 inline void resize(
const size_t N) { m_obj.points.resize(N); }
64 const pcl::PointXYZ&
p = m_obj.points[idx];
73 pcl::PointXYZ&
p = m_obj.points[idx];
82 pcl::PointXYZ&
p = m_obj.points[idx];
83 p.x =
p.y =
p.z = std::numeric_limits<float>::quiet_NaN();
94 pcl::PointCloud<pcl::PointXYZRGB>&
m_obj;
100 static const int HAS_RGB = 1;
102 static const int HAS_RGBf = 0;
104 static const int HAS_RGBu8 = 1;
108 : m_obj(*const_cast<pcl::PointCloud<pcl::PointXYZRGB>*>(&
obj))
112 inline size_t size()
const {
return m_obj.points.size(); }
114 inline void resize(
const size_t N) { m_obj.points.resize(N); }
123 template <
typename T>
126 const pcl::PointXYZRGB&
p = m_obj.points[idx];
135 pcl::PointXYZRGB&
p = m_obj.points[idx];
139 p.r =
p.g =
p.b = 255;
143 template <
typename T>
145 const size_t idx, T&
x, T&
y, T&
z,
float&
r,
float&
g,
float&
b)
const 147 const pcl::PointXYZRGB&
p = m_obj.points[idx];
158 const float r,
const float g,
const float b)
160 pcl::PointXYZRGB&
p = m_obj.points[idx];
170 template <
typename T>
175 const pcl::PointXYZRGB&
p = m_obj.points[idx];
188 pcl::PointXYZRGB&
p = m_obj.points[idx];
199 const size_t idx,
float&
r,
float&
g,
float&
b)
const 201 const pcl::PointXYZRGB&
p = m_obj.points[idx];
208 const size_t idx,
const float r,
const float g,
const float b)
210 pcl::PointXYZRGB&
p = m_obj.points[idx];
220 const pcl::PointXYZRGB&
p = m_obj.points[idx];
229 pcl::PointXYZRGB&
p = m_obj.points[idx];
245 pcl::PointCloud<pcl::PointXYZRGBA>&
m_obj;
251 static const int HAS_RGB = 1;
253 static const int HAS_RGBf = 0;
255 static const int HAS_RGBu8 = 1;
259 : m_obj(*const_cast<pcl::PointCloud<pcl::PointXYZRGBA>*>(&
obj))
263 inline size_t size()
const {
return m_obj.points.size(); }
265 inline void resize(
const size_t N) { m_obj.points.resize(N); }
274 template <
typename T>
277 const pcl::PointXYZRGBA&
p = m_obj.points[idx];
286 pcl::PointXYZRGBA&
p = m_obj.points[idx];
290 p.r =
p.g =
p.b = 255;
296 pcl::PointXYZRGBA&
p = m_obj.points[idx];
297 p.x =
p.y =
p.z = std::numeric_limits<float>::quiet_NaN();
301 template <
typename T>
303 const size_t idx, T&
x, T&
y, T&
z,
float&
r,
float&
g,
float&
b)
const 305 const pcl::PointXYZRGBA&
p = m_obj.points[idx];
316 const float r,
const float g,
const float b)
318 pcl::PointXYZRGBA&
p = m_obj.points[idx];
328 template <
typename T>
333 const pcl::PointXYZRGBA&
p = m_obj.points[idx];
346 pcl::PointXYZRGBA&
p = m_obj.points[idx];
357 const size_t idx,
float&
r,
float&
g,
float&
b)
const 359 const pcl::PointXYZRGBA&
p = m_obj.points[idx];
366 const size_t idx,
const float r,
const float g,
const float b)
368 pcl::PointXYZRGBA&
p = m_obj.points[idx];
378 const pcl::PointXYZRGBA&
p = m_obj.points[idx];
387 pcl::PointXYZRGBA&
p = m_obj.points[idx];
void setPointRGBf(const size_t idx, 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)
pcl::PointCloud< pcl::PointXYZRGBA > & m_obj
void getPointRGBu8(const size_t idx, uint8_t &r, uint8_t &g, uint8_t &b) const
Get RGBu8 color of i'th point.
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.
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.
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 setDimensions(const size_t &height, const size_t &width)
Set height and width (for organized)
size_t size() const
Get number of points.
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 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.
GLsizei GLsizei GLuint * obj
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 setDimensions(const size_t &height, const size_t &width)
Set height and width (for organized)
void setPointRGBf(const size_t idx, const float r, const float g, const float b)
Set XYZ_RGBf coordinates of i'th point.
void resize(const size_t N)
Set number of points (to uninitialized values)
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 setDimensions(const size_t &height, const size_t &width)
Set height and width (for organized)
An adapter to different kinds of point cloud object.
pcl::PointCloud< pcl::PointXYZRGB > & m_obj
float coords_t
The type of each point XYZ coordinates.
void resize(const size_t N)
Set number of points (to uninitialized values)
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 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.
PointCloudAdapter(const pcl::PointCloud< pcl::PointXYZ > &obj)
Constructor (accept a const ref for convenience)
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.
void setInvalidPoint(const size_t idx)
Set Invalid Point.
void getPointXYZ(const size_t idx, T &x, T &y, T &z) const
Get XYZ coordinates of i'th point.
GLdouble GLdouble GLdouble r
float coords_t
The type of each point XYZ coordinates.
void resize(const size_t N)
Set number of points (to uninitialized values)
void getPointRGBu8(const size_t idx, uint8_t &r, uint8_t &g, uint8_t &b) const
Get RGBu8 color of i'th point.
void getPointRGBf(const size_t idx, float &r, float &g, float &b) const
Get RGBf color of i'th point.
The namespace for 3D scene representation and rendering.
pcl::PointCloud< pcl::PointXYZ > & m_obj
A helper base class for those PointCloudAdapter<> which do not handle RGB data; it declares needed in...
void getPointRGBf(const size_t idx, float &r, float &g, float &b) const
Get RGBf color of i'th point.
void setInvalidPoint(const size_t idx)
Set Invalid 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'th point.
GLenum GLsizei GLsizei height
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::PointXYZRGB > &obj)
Constructor (accept a const ref for convenience)
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.