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);
84 virtual size_t PLY_export_get_vertex_count()
const;
92 virtual void PLY_export_get_vertex(
106 this->octree_getBoundingBox(bb_min, bb_max);
112 inline size_t size()
const {
return m_xs.size(); }
115 inline void resize(
size_t N) { m_xs.resize(N); m_ys.resize(N); m_zs.resize(N); m_minmax_valid =
false; markAllPointsAsNew(); }
118 inline void reserve(
size_t N) { m_xs.reserve(N); m_ys.reserve(N); m_zs.reserve(N); }
121 void setAllPoints(
const std::vector<float> &x,
const std::vector<float> &y,
const std::vector<float> &z)
126 m_minmax_valid =
false;
127 markAllPointsAsNew();
137 m_minmax_valid =
false;
138 markAllPointsAsNew();
141 inline const std::vector<float> &
getArrayX()
const {
return m_xs;}
142 inline const std::vector<float> &
getArrayY()
const {
return m_ys;}
143 inline const std::vector<float> &
getArrayZ()
const {
return m_zs;}
148 void insertPoint(
float x,
float y,
float z );
175 void setPoint(
size_t i,
const float x,
const float y,
const float z);
178 inline void setPoint_fast(
size_t i,
const float x,
const float y,
const float z)
183 m_minmax_valid =
false;
184 markAllPointsAsNew();
189 template <
class POINTSMAP>
190 void loadFromPointsMap(
const POINTSMAP *themap);
198 const size_t N = pointsList.size();
206 for ( idx=0,it=pointsList.begin() ; idx<N ; ++idx,++it)
212 markAllPointsAsNew();
245 void render_subset(
const bool all,
const std::vector<size_t>& idxs,
const float render_area_sqpixels )
const;
254 mutable float m_min, m_max,m_max_m_min,m_max_m_min_inv;
260 inline void internal_render_one_point(
size_t i)
const;
277 static const int HAS_RGB = 0;
278 static const int HAS_RGBf = 0;
279 static const int HAS_RGBu8 = 0;
284 inline size_t size()
const {
return m_obj.
size(); }
289 template <
typename T>
290 inline void getPointXYZ(
const size_t idx, T &x,T &y, T &z)
const {
296 inline void setPointXYZ(
const size_t idx,
const coords_t x,
const coords_t y,
const coords_t z) {
306 template <
class POINTSMAP>
312 const size_t N=pc_src.size();
314 for (
size_t i=0;i<N;i++)
317 pc_src.getPointXYZ(i,x,y,z);
318 pc_dst.setPointXYZ(i,x,y,z);
float coords_t
The type of each point XYZ coordinates.
const std::vector< float > & getArrayY() const
Get a const reference to the internal array of Y coordinates.
void resize(size_t N)
Set the number of points (with contents undefined)
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 loadFromPointsMap(const POINTSMAP *themap)
Load the points from any other point map class supported by the adapter mrpt::utils::PointCloudAdapte...
void enableColorFromX(bool v=true)
A helper base class for those PointCloudAdapter<> which do not handle RGB data; it declares needed in...
mrpt::utils::TColorf m_col_slop_inv
Color linear function slope.
void loadFromPointsList(LISTOFPOINTS &pointsList)
Load the points from a list of mrpt::math::TPoint3D.
#define ASSERT_BELOW_(__A, __B)
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).
The base class of 3D objects that can be directly rendered through OpenGL.
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...
const Scalar * const_iterator
virtual ~CPointCloud()
Private, virtual destructor: only can be deleted from smart pointers.
mrpt::utils::TColorf m_colorFromDepth_min
void reserve(size_t N)
Like STL std::vector's reserve.
float getPointSize() const
void enableColorFromY(bool v=true)
bool m_pointSmooth
Default: false.
Template class that implements the data structure and algorithms for Octree-based efficient rendering...
const std::vector< float > & getArrayZ() const
Get a const reference to the internal array of Z coordinates.
#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).
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
void setPointSize(float p)
By default is 1.0.
void enableColorFromZ(bool v=true)
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...
PointCloudAdapter(const mrpt::opengl::CPointCloud &obj)
Constructor (accept a const ref for convenience)
const std::vector< float > & getArrayX() const
Get a const reference to the internal array of X coordinates.
An adapter to different kinds of point cloud object.
virtual size_t PLY_export_get_face_count() const
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.
size_t size() const
Get number of points.
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...
void enablePointSmooth(bool enable=true)
volatile size_t m_last_rendered_count_ongoing
bool isPointSmoothEnabled() const
void getPointXYZ(const size_t idx, T &x, T &y, T &z) const
Get XYZ coordinates of i'th point.
mrpt::opengl::CPointCloud & m_obj
size_t size(const MATRIXLIKE &m, int dim)
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.
float m_pointSize
By default is 1.0.
mrpt::math::TPoint3D getPoint(size_t i) const
Read access to each individual point (checks for "i" in the valid range only in Debug).
A RGB color - floats in the range [0,1].
void disablePointSmooth()
An adapter to different kinds of point cloud object.
#define DEFINE_SERIALIZABLE_POST_CUSTOM_BASE_LINKAGE(class_name, base_name, _LINKAGE_)
size_t getActuallyRendered() const
Get the number of elements actually rendered in the last render event.
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) ...
std::vector< float > m_zs
A cloud of points, all with the same color or each depending on its value along a particular coordina...
void resize(const size_t N)
Set number of points (to uninitialized values)