29 #ifndef opengl_CPointCloud_H
30 #define opengl_CPointCloud_H
73 enum
Axis { None=0,
Z, Y, X} m_colorFromDepth;
74 std::vector<float> m_xs,m_ys,
m_zs;
80 void markAllPointsAsNew();
86 virtual void PLY_import_set_vertex_count(
const size_t N);
101 virtual size_t PLY_export_get_vertex_count()
const;
109 virtual void PLY_export_get_vertex(
123 inline size_t size()
const {
return m_xs.size(); }
126 inline void resize(
size_t N) { m_xs.resize(N); m_ys.resize(N); m_zs.resize(N); m_minmax_valid =
false; markAllPointsAsNew(); }
129 inline void reserve(
size_t N) { m_xs.reserve(N); m_ys.reserve(N); m_zs.reserve(N); }
132 void setAllPoints(
const std::vector<float> &x,
const std::vector<float> &y,
const std::vector<float> &z)
137 m_minmax_valid =
false;
138 markAllPointsAsNew();
142 void setAllPointsFast(std::vector<float> &x, std::vector<float> &y, std::vector<float> &z)
148 m_minmax_valid =
false;
149 markAllPointsAsNew();
152 inline const std::vector<float> &
getArrayX()
const {
return m_xs;}
153 inline const std::vector<float> &
getArrayY()
const {
return m_ys;}
154 inline const std::vector<float> &
getArrayZ()
const {
return m_zs;}
159 void insertPoint(
float x,
float y,
float z );
186 void setPoint(
size_t i,
const float x,
const float y,
const float z);
189 inline void setPoint_fast(
size_t i,
const float x,
const float y,
const float z)
194 m_minmax_valid =
false;
195 markAllPointsAsNew();
200 template <
class POINTSMAP>
201 void loadFromPointsMap(
const POINTSMAP *themap);
206 template<
class LISTOFPOINTS>
void loadFromPointsList( LISTOFPOINTS &pointsList)
209 const size_t N = pointsList.size();
217 for ( idx=0,it=pointsList.begin() ; idx<N ; ++idx,++it)
223 markAllPointsAsNew();
256 void render_subset(
const bool all,
const std::vector<size_t>& idxs,
const float render_area_sqpixels )
const;
265 mutable float m_min, m_max,m_max_m_min,m_max_m_min_inv;
271 inline void internal_render_one_point(
size_t i)
const;
287 static const int HAS_RGB = 0;
288 static const int HAS_RGBf = 0;
289 static const int HAS_RGBu8 = 0;
294 inline size_t size()
const {
return m_obj.size(); }
296 inline void resize(
const size_t N) { m_obj.resize(N); }
299 template <
typename T>
300 inline void getPointXYZ(
const size_t idx, T &x,T &y, T &z)
const {
301 x=m_obj.getArrayX()[idx];
302 y=m_obj.getArrayY()[idx];
303 z=m_obj.getArrayZ()[idx];
307 m_obj.setPoint_fast(idx,x,y,z);
316 template <
class POINTSMAP>
319 mrpt::utils::PointCloudAdapter<CPointCloud> pc_dst(*
this);
320 const mrpt::utils::PointCloudAdapter<POINTSMAP> pc_src(*themap);
321 const size_t N=pc_src.size();
323 for (
size_t i=0;i<N;i++)
326 pc_src.getPointXYZ(i,x,y,z);
327 pc_dst.setPointXYZ(i,x,y,z);