Go to the documentation of this file.
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) { }
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); }
134 void setPoint(
size_t i,
const TPointColour &p );
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>
257 inline void getPointXYZ(
const size_t idx, T &x,T &y, T &z)
const {
269 template <
typename T>
270 inline void getPointXYZ_RGBf(
const size_t idx, T &x,T &y, T &z,
float &r,
float &g,
float &b)
const {
272 x=pc.
x; y=pc.
y; z=pc.
z;
273 r=pc.
R; g=pc.
G; b=pc.
B;
281 template <
typename T>
282 inline void getPointXYZ_RGBu8(
const size_t idx, T &x,T &y, T &z, uint8_t &r,uint8_t &g,uint8_t &b)
const {
284 x=pc.
x; y=pc.
y; z=pc.
z;
285 r=pc.
R*255; g=pc.
G*255; b=pc.
B*255;
298 inline void getPointRGBu8(
const size_t idx, uint8_t &r,uint8_t &g,uint8_t &b)
const {
301 r=R*255; g=G*255; b=B*255;
304 inline void setPointRGBu8(
const size_t idx,
const uint8_t r,
const uint8_t g,
const uint8_t b) {
313 template <
class POINTSMAP>
318 const size_t N=pc_src.size();
320 for (
size_t i=0;i<N;i++)
323 pc_src.getPointXYZ_RGBf(i,x,y,z,r,g,b);
324 pc_dst.setPointXYZ_RGBf(i,x,y,z,r,g,b);
size_t getActuallyRendered() const
Get the number of elements actually rendered in the last render event.
Lightweight 3D point (float version).
An adapter to different kinds of point cloud object.
const_iterator end() const
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.
virtual ~CPointCloudColoured()
Private, virtual destructor: only can be deleted from smart pointers.
void clear()
Erase all the points.
std::vector< TPointColour > TListPointColour
const_iterator begin() const
void setPointSize(float pointSize)
void setPointRGBf(const size_t idx, const float r, const float g, const float b)
Set XYZ_RGBf coordinates of i'th point.
TColormap
Different colormaps.
size_t size() const
Return the number of points.
The base class of 3D objects that can be directly rendered through OpenGL.
bool m_pointSmooth
Default: false.
size_t size(const MATRIXLIKE &m, int dim)
void setPoint_fast(const size_t i, const TPointColour &p)
Like setPoint() but does not check for index out of bounds.
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
size_t size() const
Get number of points.
#define MRPT_DECLARE_TTYPENAME_NAMESPACE(_TYPE, __NS)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
const typedef Scalar * const_iterator
PointCloudAdapter(const mrpt::opengl::CPointCloudColoured &obj)
Constructor (accept a const ref for convenience)
#define ASSERT_BELOW_(__A, __B)
const TPointColour & getPoint(size_t i) const
Read access to each individual point (checks for "i" in the valid range only in Debug).
TListPointColour::const_iterator const_iterator
void getPointRGBf(const size_t idx, float &r, float &g, float &b) const
Get RGBf color 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 resize(size_t N)
Set the number of points, with undefined contents.
void getPointXYZ(const size_t idx, T &x, T &y, T &z) const
Get XYZ coordinates of i'th point.
EIGEN_STRONG_INLINE void push_back(Scalar val)
Insert an element at the end of the container (for 1D vectors/arrays)
float getPointSize() const
TListPointColour::iterator iterator
float coords_t
The type of each point XYZ coordinates.
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
void reserve(size_t N)
Like STL std::vector's reserve.
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...
CPointCloudColoured()
Constructor.
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
void resize(const size_t N)
Set number of points (to uninitialized values)
TListPointColour m_points
void enablePointSmooth(bool enable=true)
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.
bool isPointSmoothEnabled() const
OPENGL_IMPEXP mrpt::utils::CStream & operator<<(mrpt::utils::CStream &out, const mrpt::opengl::CLight &o)
A RGB color - floats in the range [0,1].
#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...
::mrpt::utils::CStream & operator>>(mrpt::utils::CStream &in, CAngularObservationMeshPtr &pObj)
void loadFromPointsMap(const POINTSMAP *themap)
Load the points from any other point map class supported by the adapter mrpt::utils::PointCloudAdapte...
TPointColour(float _x, float _y, float _z, float _R, float _G, float _B)
Template class that implements the data structure and algorithms for Octree-based efficient rendering...
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
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 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.
volatile size_t m_last_rendered_count_ongoing
mrpt::opengl::CPointCloudColoured & m_obj
void disablePointSmooth()
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 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 getPointRGBu8(const size_t idx, uint8_t &r, uint8_t &g, uint8_t &b) const
Get RGBu8 color of i'th point.
void getPointColor_fast(size_t index, float &R, float &G, float &B) const
Like getPointColor but without checking for out-of-index erors.
The namespace for 3D scene representation and rendering.
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
A cloud of points, each one with an individual colour (R,G,B).
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 setPointColor_fast(size_t index, float R, float G, float B)
Like setPointColor but without checking for out-of-index erors.
Page generated by Doxygen 1.8.16 for MRPT 1.4.0 SVN: at Mon Oct 14 22:32:58 UTC 2019 | | |