10 #ifndef opengl_CPointCloudColoured_H
11 #define opengl_CPointCloudColoured_H
48 public
mrpt::utils::PLY_Importer,
49 public
mrpt::utils::PLY_Exporter
57 inline TPointColour(
float _x,
float _y,
float _z,
float _R,
float _G,
float _B ) : x(_x),y(_y),z(_z),R(_R),G(_G),B(_B) { }
67 inline iterator
begin() {
return m_points.begin(); }
68 inline const_iterator
begin()
const {
return m_points.begin(); }
69 inline iterator
end() {
return m_points.end(); }
70 inline const_iterator
end()
const {
return m_points.end(); }
83 m_last_rendered_count(0),
84 m_last_rendered_count_ongoing(0)
90 void markAllPointsAsNew();
97 this->octree_getBoundingBox(bb_min, bb_max);
104 void push_back(
float x,
float y,
float z,
float R,
float G,
float B);
107 inline void resize(
size_t N) { m_points.resize(N); markAllPointsAsNew(); }
110 inline void reserve(
size_t N) { m_points.reserve(N); }
137 void setPoint(
size_t i,
const TPointColour &p );
142 markAllPointsAsNew();
146 inline void setPoint_fast(
const size_t i,
const float x,
const float y,
const float z ) {
149 markAllPointsAsNew();
162 R = m_points[index].R;
163 G = m_points[index].G;
164 B = m_points[index].B;
167 inline size_t size()
const {
return m_points.size(); }
169 inline void clear() { m_points.clear(); markAllPointsAsNew(); }
172 template <
class POINTSMAP>
173 void loadFromPointsMap(
const POINTSMAP *themap);
199 void render_subset(
const bool all,
const std::vector<size_t>& idxs,
const float render_area_sqpixels )
const;
205 virtual void PLY_import_set_vertex_count(
const size_t N);
220 virtual size_t PLY_export_get_vertex_count()
const;
228 virtual void PLY_export_get_vertex(
261 static const int HAS_RGB = 1;
262 static const int HAS_RGBf = 1;
263 static const int HAS_RGBu8 = 0;
268 inline size_t size()
const {
return m_obj.
size(); }
273 template <
typename T>
274 inline void getPointXYZ(
const size_t idx, T &x,T &y, T &z)
const {
281 inline void setPointXYZ(
const size_t idx,
const coords_t x,
const coords_t y,
const coords_t z) {
286 template <
typename T>
287 inline void getPointXYZ_RGBf(
const size_t idx, T &x,T &y, T &z,
float &r,
float &g,
float &b)
const {
289 x=pc.
x; y=pc.
y; z=pc.
z;
290 r=pc.
R; g=pc.
G; b=pc.
B;
293 inline 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) {
298 template <
typename T>
299 inline void getPointXYZ_RGBu8(
const size_t idx, T &x,T &y, T &z, uint8_t &r,uint8_t &g,uint8_t &b)
const {
301 x=pc.
x; y=pc.
y; z=pc.
z;
302 r=pc.
R*255; g=pc.
G*255; b=pc.
B*255;
305 inline 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) {
315 inline void getPointRGBu8(
const size_t idx, uint8_t &r,uint8_t &g,uint8_t &b)
const {
318 r=R*255; g=G*255; b=B*255;
321 inline void setPointRGBu8(
const size_t idx,
const uint8_t r,
const uint8_t g,
const uint8_t b) {
332 template <
class POINTSMAP>
337 const size_t N=pc_src.size();
339 for (
size_t i=0;i<N;i++)
342 pc_src.getPointXYZ_RGBf(i,x,y,z,r,g,b);
343 pc_dst.setPointXYZ_RGBf(i,x,y,z,r,g,b);
float coords_t
The type of each point XYZ coordinates.
#define MRPT_DECLARE_TTYPENAME_NAMESPACE(_TYPE, __NS)
PointCloudAdapter(const mrpt::opengl::CPointCloudColoured &obj)
Constructor (accept a const ref for convenience)
void clear()
Erase all the points.
bool m_pointSmooth
Default: false.
size_t size() const
Get number of points.
bool isPointSmoothEnabled() const
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.
float getPointSize() const
A cloud of points, each one with an individual colour (R,G,B).
#define ASSERT_BELOW_(__A, __B)
volatile size_t m_last_rendered_count_ongoing
The base class of 3D objects that can be directly rendered through OpenGL.
class BASE_IMPEXP CStream
EIGEN_STRONG_INLINE void push_back(Scalar val)
Insert an element at the end of the container (for 1D vectors/arrays)
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.
const Scalar * const_iterator
mrpt::math::TPoint3Df getPointf(size_t i) const
Read access to each individual point (checks for "i" in the valid range only in Debug).
mrpt::opengl::CPointCloudColoured & m_obj
void disablePointSmooth()
void getPointColor_fast(size_t index, float &R, float &G, float &B) const
Like getPointColor but without checking for out-of-index erors.
void resize(const size_t N)
Set number of points (to uninitialized values)
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 loadFromPointsMap(const POINTSMAP *themap)
Load the points from any other point map class supported by the adapter mrpt::utils::PointCloudAdapte...
Template class that implements the data structure and algorithms for Octree-based efficient rendering...
virtual void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const
Evaluates the bounding box of this object (including possible children) in the coordinate frame of th...
const_iterator begin() const
TPointColour(float _x, float _y, float _z, float _R, float _G, float _B)
#define DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
virtual size_t PLY_export_get_face_count() const
In a base class, return the number of faces.
Lightweight 3D point (float version).
CPointCloudColoured()
Constructor.
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
TListPointColour::iterator iterator
size_t getActuallyRendered() const
Get the number of elements actually rendered in the last render event.
An adapter to different kinds of point cloud object.
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_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 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 setPointSize(float pointSize)
void enablePointSmooth(bool enable=true)
void getPointRGBu8(const size_t idx, uint8_t &r, uint8_t &g, uint8_t &b) const
Get RGBu8 color of i'th point.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
size_t size() const
Return the number of points.
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
std::vector< TPointColour > TListPointColour
void setPointColor_fast(size_t index, float R, float G, float B)
Like setPointColor but without checking for out-of-index erors.
TListPointColour::const_iterator const_iterator
TListPointColour m_points
size_t size(const MATRIXLIKE &m, int dim)
The namespace for 3D scene representation and rendering.
A RGB color - floats in the range [0,1].
virtual void PLY_import_set_face_count(const size_t N)
In a base class, reserve memory to prepare subsequent calls to PLY_import_set_face.
void setPoint_fast(const size_t i, const TPointColour &p)
Like setPoint() but does not check for index out of bounds.
An adapter to different kinds of point cloud object.
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.
void setPoint_fast(const size_t i, const float x, const float y, const float z)
Like setPoint() but does not check for index out of bounds.
float m_pointSize
By default is 1.0.
void getPointXYZ(const size_t idx, T &x, T &y, T &z) const
Get XYZ coordinates of i'th point.
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
const_iterator end() const
void resize(size_t N)
Set the number of points, with undefined contents.
void getPointRGBf(const size_t idx, float &r, float &g, float &b) const
Get RGBf color of i'th point.
void reserve(size_t N)
Like STL std::vector's reserve.
const TPointColour & getPoint(size_t i) const
Read access to each individual point (checks for "i" in the valid range only in Debug).
virtual ~CPointCloudColoured()
Private, virtual destructor: only can be deleted from smart pointers.