Go to the documentation of this file.
10 #ifndef opengl_CPointCloud_H
11 #define opengl_CPointCloud_H
49 public
mrpt::utils::PLY_Importer,
50 public
mrpt::utils::PLY_Exporter
54 enum Axis { colNone=0,
colZ, colY, colX} m_colorFromDepth;
55 std::vector<float> m_xs,m_ys,
m_zs;
61 void markAllPointsAsNew();
67 virtual void PLY_import_set_vertex_count(
const size_t N)
MRPT_OVERRIDE;
91 this->octree_getBoundingBox(bb_min, bb_max);
97 inline size_t size()
const {
return m_xs.size(); }
100 inline void resize(
size_t N) { m_xs.resize(N); m_ys.resize(N); m_zs.resize(N); m_minmax_valid =
false; markAllPointsAsNew(); }
103 inline void reserve(
size_t N) { m_xs.reserve(N); m_ys.reserve(N); m_zs.reserve(N); }
106 void setAllPoints(
const std::vector<float> &x,
const std::vector<float> &y,
const std::vector<float> &z)
111 m_minmax_valid =
false;
112 markAllPointsAsNew();
122 m_minmax_valid =
false;
123 markAllPointsAsNew();
126 inline const std::vector<float> & getArrayX()
const {
return m_xs;}
127 inline const std::vector<float> & getArrayY()
const {
return m_ys;}
128 inline const std::vector<float> & getArrayZ()
const {
return m_zs;}
133 void insertPoint(
float x,
float y,
float z );
160 void setPoint(
size_t i,
const float x,
const float y,
const float z);
163 inline void setPoint_fast(
size_t i,
const float x,
const float y,
const float z)
168 m_minmax_valid =
false;
169 markAllPointsAsNew();
174 template <
class POINTSMAP>
175 void loadFromPointsMap(
const POINTSMAP *themap);
183 const size_t N = pointsList.size();
191 for ( idx=0,it=pointsList.begin() ; idx<N ; ++idx,++it)
197 markAllPointsAsNew();
213 inline void setPointSize(
float p) { m_pointSize=p; }
229 void render_subset(const
bool all, const std::vector<
size_t>& idxs, const
float render_area_sqpixels ) const;
238 mutable float m_min, m_max,m_max_m_min,m_max_m_min_inv;
244 inline void internal_render_one_point(
size_t i)
const;
261 static const int HAS_RGB = 0;
262 static const int HAS_RGBf = 0;
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 {
275 x=m_obj.getArrayX()[idx];
276 y=m_obj.getArrayY()[idx];
277 z=m_obj.getArrayZ()[idx];
290 template <
class POINTSMAP>
296 const size_t N=pc_src.size();
298 for (
size_t i=0;i<N;i++)
301 pc_src.getPointXYZ(i,x,y,z);
302 pc_dst.setPointXYZ(i,x,y,z);
Lightweight 3D point (float version).
An adapter to different kinds of point cloud object.
void setAllPointsFast(std::vector< float > &x, std::vector< float > &y, std::vector< float > &z)
Set the list of (X,Y,Z) point coordinates, DESTROYING the contents of the input vectors (via swap)
The base class of 3D objects that can be directly rendered through OpenGL.
void loadFromPointsMap(const POINTSMAP *themap)
Load the points from any other point map class supported by the adapter mrpt::utils::PointCloudAdapte...
size_t size(const MATRIXLIKE &m, int dim)
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
mrpt::opengl::CPointCloud & m_obj
const typedef Scalar * const_iterator
#define ASSERT_BELOW_(__A, __B)
float coords_t
The type of each point XYZ coordinates.
void setAllPoints(const std::vector< float > &x, const std::vector< float > &y, const std::vector< float > &z)
Set the list of (X,Y,Z) point coordinates, all at once, from three vectors with their coordinates.
void disablePointSmooth()
mrpt::utils::TColorf m_col_slop_inv
Color linear function slope.
size_t size() const
Get number of points.
volatile size_t m_last_rendered_count_ongoing
float m_pointSize
By default is 1.0.
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 enablePointSmooth(bool enable=true)
void loadFromPointsList(LISTOFPOINTS &pointsList)
Load the points from a list of mrpt::math::TPoint3D.
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...
PointCloudAdapter(const mrpt::opengl::CPointCloud &obj)
Constructor (accept a const ref for convenience)
void resize(const size_t N)
Set number of points (to uninitialized values)
bool isPointSmoothEnabled() const
std::vector< float > m_zs
void enableColorFromY(bool v=true)
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
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.
A cloud of points, all with the same color or each depending on its value along a particular coordina...
void enableColorFromZ(bool v=true)
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...
size_t getActuallyRendered() const
Get the number of elements actually rendered in the last render event.
mrpt::math::TPoint3D getPoint(size_t i) const
Read access to each individual point (checks for "i" in the valid range only in Debug).
Template class that implements the data structure and algorithms for Octree-based efficient rendering...
void getPointXYZ(const size_t idx, T &x, T &y, T &z) const
Get XYZ coordinates of i'th point.
#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 reserve(size_t N)
Like STL std::vector's reserve.
void enableColorFromX(bool v=true)
mrpt::utils::TColorf m_colorFromDepth_min
void resize(size_t N)
Set the number of points (with contents undefined)
float getPointSize() const
bool m_pointSmooth
Default: false.
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
A helper base class for those PointCloudAdapter<> which do not handle RGB data; it declares needed in...
void setPoint_fast(size_t i, const float x, const float y, const float z)
Write an individual point (without checking validity of the index).
Page generated by Doxygen 1.8.17 for MRPT 1.4.0 SVN: at Tue Mar 3 09:15:16 UTC 2020 | | |