84 float x,
float y,
float z,
float R,
float G,
float B,
float A = 1);
122 const size_t i,
const float x,
const float y,
const float z)
130 size_t index,
float R,
float G,
float B,
float A = 1)
138 size_t index, uint8_t r, uint8_t g, uint8_t b, uint8_t a = 0xff)
147 size_t index,
float&
R,
float&
G,
float& B)
const 154 size_t index, uint8_t& r, uint8_t& g, uint8_t& b)
const 178 template <
class POINTSMAP>
193 const float coord_min,
const float coord_max,
const int coord_index = 2,
200 const bool all,
const std::vector<size_t>& idxs,
201 const float render_area_sqpixels)
const;
245 static constexpr
bool HAS_RGB =
true;
247 static constexpr
bool HAS_RGBf =
true;
249 static constexpr
bool HAS_RGBu8 =
false;
257 inline size_t size()
const {
return m_obj.
size(); }
263 template <
typename T>
284 template <
typename T>
286 const size_t idx, T& x, T& y, T& z,
float& Rf,
float& Gf,
float& Bf,
302 const float Rf,
const float Gf,
const float Bf,
const float Af)
310 template <
typename T>
312 const size_t idx, T& x, T& y, T& z, uint8_t& r, uint8_t& g,
327 const uint8_t r,
const uint8_t g,
const uint8_t b,
328 const uint8_t a = 0xff)
336 const size_t idx,
float& r,
float& g,
float& b)
const 342 const size_t idx,
const float r,
const float g,
const float b)
349 const size_t idx, uint8_t& r, uint8_t& g, uint8_t& b)
const 355 const size_t idx,
const uint8_t r,
const uint8_t g,
const uint8_t b)
363 template <
class POINTSMAP>
369 const size_t N = pc_src.size();
371 for (
size_t i = 0; i < N; i++)
375 float x, y, z, r, g, b, a;
376 pc_src.getPointXYZ_RGBAf(i, x, y, z, r, g, b, a);
377 pc_dst.setPointXYZ_RGBAf(i, x, y, z, r, g, b, a);
382 pc_src.getPointXYZ(i, x, y, z);
383 pc_dst.setPointXYZ_RGBAf(i, x, y, z, 0, 0, 0, 1);
std::vector< mrpt::math::TPoint3Df > & m_points
Actually, an alias for the base class shader container of points.
TColormap
Different colormaps for use in mrpt::img::colormap()
std::vector< mrpt::math::TPoint3Df > m_vertex_buffer_data
void getPointRGBf(const size_t idx, float &r, float &g, float &b) const
Get RGBf color of i'th point.
void clear()
Erase all the points.
size_t getActuallyRendered() const
Get the number of elements actually rendered in the last render event.
size_t m_last_rendered_count
void notifyChange() const
Call to enable calling renderUpdateBuffers() before the next render() rendering iteration.
size_t size() const
Return the number of points.
An adapter to different kinds of point cloud object.
A cloud of points, each one with an individual colour (R,G,B).
const mrpt::math::TPoint3Df & getPoint3Df(size_t i) const
void getPointColor_fast(size_t index, float &R, float &G, float &B) const
Like getPointColor but without checking for out-of-index erors.
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.
size_t size() const
Get number of points.
float coords_t
The type of each point XYZ coordinates.
void onUpdateBuffers_Points() override
Must be implemented in derived classes to update the geometric entities to be drawn in "m_*_buffer" f...
void setPointRGBf(const size_t idx, const float r, const float g, const float b)
Set XYZ_RGBf coordinates of i'th point.
void loadFromPointsMap(const POINTSMAP *themap)
Load the points from any other point map class supported by the adapter mrpt::opengl::PointCloudAdapt...
Template class that implements the data structure and algorithms for Octree-based efficient rendering...
std::vector< mrpt::img::TColor > m_color_buffer_data
std::vector< mrpt::img::TColor > & m_point_colors
void push_back(float x, float y, float z, float R, float G, float B, float A=1)
Inserts a new point into the point cloud.
void setDimensions(size_t height, size_t width)
Does nothing as of now.
void getPointXYZ(const size_t idx, T &x, T &y, T &z) const
Get XYZ coordinates of i'th point.
size_t m_last_rendered_count_ongoing
An adapter to different kinds of point cloud object.
mrpt::img::TColor getPointColor(size_t index) const
void setPointColor_fast(size_t index, float R, float G, float B, float A=1)
Like setPointColor but without checking for out-of-index erors.
void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const override
Evaluates the bounding box of this object (including possible children) in the coordinate frame of th...
void PLY_import_set_vertex(const size_t idx, const mrpt::math::TPoint3Df &pt, const mrpt::img::TColorf *pt_color=nullptr) override
In a base class, will be called after PLY_import_set_vertex_count() once for each loaded point...
size_t PLY_export_get_vertex_count() const override
In a base class, return the number of vertices.
A virtual base class that implements the capability of exporting 3D point clouds and faces to a file ...
void setPointXYZ_RGBAf(const size_t idx, const coords_t x, const coords_t y, const coords_t z, const float Rf, const float Gf, const float Bf, const float Af)
Set XYZ_RGBf coordinates of i'th point.
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.
XYZ point (float) + RGBA(u8)
mrpt::opengl::CPointCloudColoured & m_obj
void setInvalidPoint(const size_t idx)
Renderizable generic renderer for objects using the points shader.
uint8_t f2u8(const float f)
converts a float [0,1] into an uint8_t [0,255] (without checking for out of bounds) ...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void resize(const size_t N)
Set number of points (to uninitialized values)
void PLY_import_set_face_count([[maybe_unused]] const size_t N) override
In a base class, reserve memory to prepare subsequent calls to PLY_import_set_face.
void setPointColor_u8_fast(size_t index, uint8_t r, uint8_t g, uint8_t b, uint8_t a=0xff)
An RGBA color - floats in the range [0,1].
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 getPointXYZ_RGBAf(const size_t idx, T &x, T &y, T &z, float &Rf, float &Gf, float &Bf, float &Af) const
Get XYZ_RGBf coordinates of i'th point.
float u8tof(const uint8_t v)
converts a uint8_t [0,255] into a float [0,1]
void getPointRGBu8(const size_t idx, uint8_t &r, uint8_t &g, uint8_t &b) const
Get RGBu8 color of i'th point.
void PLY_export_get_vertex(const size_t idx, mrpt::math::TPoint3Df &pt, bool &pt_has_color, mrpt::img::TColorf &pt_color) const override
In a base class, will be called after PLY_export_get_vertex_count() once for each exported point...
void render_subset(const bool all, const std::vector< size_t > &idxs, const float render_area_sqpixels) const
Render a subset of points (required by octree renderer)
The namespace for 3D scene representation and rendering.
void octree_getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const
CPointCloudColoured()=default
size_t PLY_export_get_face_count() const override
In a base class, return the number of faces.
virtual ~CPointCloudColoured() override=default
void setPoint(size_t i, const mrpt::math::TPointXYZfRGBAu8 &p)
Write an individual point (checks for "i" in the valid range only in Debug).
#define DEFINE_SERIALIZABLE(class_name, NS)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
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.
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, const uint8_t a=0xff)
Set XYZ_RGBu8 coordinates of i'th point.
void recolorizeByCoordinate(const float coord_min, const float coord_max, const int coord_index=2, const mrpt::img::TColormap color_map=mrpt::img::cmJET)
Regenerates the color of each point according the one coordinate (coord_index:0,1,2 for X,Y,Z) and the given color map.
void getPointColor_fast(size_t index, uint8_t &r, uint8_t &g, uint8_t &b) const
void PLY_import_set_vertex_count(const size_t N) override
In a base class, reserve memory to prepare subsequent calls to PLY_import_set_vertex.
PointCloudAdapter(const mrpt::opengl::CPointCloudColoured &obj)
Constructor (accept a const ref for convenience)
void resize(size_t N)
Set the number of points, with undefined contents.
A virtual base class that implements the capability of importing 3D point clouds and faces from a fil...
void reserve(size_t N)
Like STL std::vector's reserve.
void setPoint_fast(const size_t i, const mrpt::math::TPointXYZfRGBAu8 &p)
Like setPoint() but does not check for index out of bounds.
void markAllPointsAsNew()