10 #ifndef opengl_CPointCloudColoured_H 11 #define opengl_CPointCloudColoured_H 45 public
mrpt::utils::PLY_Importer,
46 public
mrpt::utils::PLY_Exporter
54 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) { }
64 inline iterator
begin() {
return m_points.begin(); }
65 inline const_iterator
begin()
const {
return m_points.begin(); }
66 inline iterator
end() {
return m_points.end(); }
67 inline const_iterator
end()
const {
return m_points.end(); }
80 m_last_rendered_count(0),
81 m_last_rendered_count_ongoing(0)
87 void markAllPointsAsNew();
94 this->octree_getBoundingBox(bb_min, bb_max);
101 void push_back(
float x,
float y,
float z,
float R,
float G,
float B);
104 inline void resize(
size_t N) { m_points.resize(N); markAllPointsAsNew(); }
107 inline void reserve(
size_t N) { m_points.reserve(N); }
139 markAllPointsAsNew();
143 inline void setPoint_fast(
const size_t i,
const float x,
const float y,
const float z ) {
146 markAllPointsAsNew();
159 R = m_points[index].R;
160 G = m_points[index].G;
161 B = m_points[index].B;
164 inline size_t size()
const {
return m_points.size(); }
166 inline void clear() { m_points.clear(); markAllPointsAsNew(); }
169 template <
class POINTSMAP>
170 void loadFromPointsMap(
const POINTSMAP *themap);
197 void render_subset(
const bool all,
const std::vector<size_t>& idxs,
const float render_area_sqpixels )
const;
203 virtual void PLY_import_set_vertex_count(
const size_t N)
MRPT_OVERRIDE;
244 static const int HAS_RGB = 1;
245 static const int HAS_RGBf = 1;
246 static const int HAS_RGBu8 = 0;
251 inline size_t size()
const {
return m_obj.
size(); }
256 template <
typename T>
264 inline void setPointXYZ(
const size_t idx,
const coords_t
x,
const coords_t y,
const coords_t
z) {
270 THROW_EXCEPTION(
"mrpt::opengl::CPointCloudColoured needs to be dense");
274 template <
typename T>
277 x=pc.
x; y=pc.
y; z=pc.
z;
278 r=pc.
R; g=pc.
G; b=pc.
B;
281 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) {
286 template <
typename T>
287 inline void getPointXYZ_RGBu8(
const size_t idx, T &
x,T &y, T &
z, uint8_t &r,uint8_t &g,uint8_t &b)
const {
289 x=pc.
x; y=pc.
y; z=pc.
z;
290 r=pc.
R*255; g=pc.
G*255; b=pc.
B*255;
293 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) {
303 inline void getPointRGBu8(
const size_t idx, uint8_t &r,uint8_t &g,uint8_t &b)
const {
306 r=R*255; g=G*255; b=B*255;
309 inline void setPointRGBu8(
const size_t idx,
const uint8_t r,
const uint8_t g,
const uint8_t b) {
318 template <
class POINTSMAP>
323 const size_t N=pc_src.size();
325 for (
size_t i=0;i<N;i++)
328 pc_src.getPointXYZ_RGBf(i,x,y,z,r,g,b);
329 pc_dst.setPointXYZ_RGBf(i,x,y,z,r,g,b);
float coords_t
The type of each point XYZ coordinates.
const_iterator end() const
#define MRPT_DECLARE_TTYPENAME_NAMESPACE(_TYPE, __NS)
PointCloudAdapter(const mrpt::opengl::CPointCloudColoured &obj)
Constructor (accept a const ref for convenience)
OPENGL_IMPEXP mrpt::utils::CStream & operator<<(mrpt::utils::CStream &out, const mrpt::opengl::CLight &o)
void clear()
Erase all the points.
bool m_pointSmooth
Default: false.
size_t size() const
Get number of points.
size_t getActuallyRendered() const
Get the number of elements actually rendered in the last render event.
size_t size(const MATRIXLIKE &m, const int dim)
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
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.
TColormap
Different colormaps for use in mrpt::utils::colormap()
::mrpt::utils::CStream & operator>>(mrpt::utils::CStream &in, CAngularObservationMeshPtr &pObj)
size_t size() const
Return the number of points.
#define THROW_EXCEPTION(msg)
A cloud of points, each one with an individual colour (R,G,B).
#define ASSERT_BELOW_(__A, __B)
virtual void PLY_import_set_face_count(const size_t N) MRPT_OVERRIDE
In a base class, reserve memory to prepare subsequent calls to PLY_import_set_face.
volatile size_t m_last_rendered_count_ongoing
void getPointColor_fast(size_t index, float &R, float &G, float &B) const
Like getPointColor but without checking for out-of-index erors.
The base class of 3D objects that can be directly rendered through OpenGL.
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::opengl::CPointCloudColoured & m_obj
void disablePointSmooth()
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 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...
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
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...
Lightweight 3D point (float version).
CPointCloudColoured()
Constructor.
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
virtual void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const MRPT_OVERRIDE
Evaluates the bounding box of this object (including possible children) in the coordinate frame of th...
const_iterator begin() const
VALUE & operator[](const KEY &key)
Write/read via [i] operator, that creates an element if it didn't exist already.
bool isPointSmoothEnabled() const
TListPointColour::iterator iterator
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.
size_t PLY_export_get_face_count() const MRPT_OVERRIDE
In a base class, return the number of faces.
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)
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...
std::vector< TPointColour > TListPointColour
mrpt::math::TPoint3Df getPointf(size_t i) const
Read access to each individual point (checks for "i" in the valid range only in Debug).
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
The namespace for 3D scene representation and rendering.
x y t t *t x y t t t x y t t t x *y t *t t x *y t *t t x y t t t x y t t t x(y+z)
void getPointXYZ(const size_t idx, T &x, T &y, T &z) const
Get XYZ coordinates of i'th point.
A RGB color - floats in the range [0,1].
void setInvalidPoint(const size_t idx)
const TPointColour & getPoint(size_t i) const
Read access to each individual point (checks for "i" in the valid range only in Debug).
void setPoint_fast(const size_t i, const TPointColour &p)
Like setPoint() but does not check for index out of bounds.
float getPointSize() const
An adapter to different kinds of point cloud object.
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.
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
void getPointRGBf(const size_t idx, float &r, float &g, float &b) const
Get RGBf color of i'th point.
void resize(size_t N)
Set the number of points, with undefined contents.
void reserve(size_t N)
Like STL std::vector's reserve.
void getPointRGBu8(const size_t idx, uint8_t &r, uint8_t &g, uint8_t &b) const
Get RGBu8 color of i'th point.
virtual ~CPointCloudColoured()
Private, virtual destructor: only can be deleted from smart pointers.