132 template <
typename T>
134 const std::vector<T>& x,
const std::vector<T>& y,
135 const std::vector<T>& z)
137 const auto N = x.size();
139 for (
size_t i = 0; i < N; i++)
140 m_points[i] = {
static_cast<float>(x[i]), static_cast<float>(y[i]),
141 static_cast<float>(z[i])};
147 void setAllPoints(
const std::vector<mrpt::math::TPoint3D>& pts);
189 void setPoint(
size_t i,
const float x,
const float y,
const float z);
193 size_t i,
const float x,
const float y,
const float z)
202 template <
class POINTSMAP>
208 template <
class LISTOFPOINTS>
212 const size_t N = pointsList.size();
215 typename LISTOFPOINTS::const_iterator it;
216 for (idx = 0, it = pointsList.begin(); idx < N; ++idx, ++it)
217 m_points[idx] = {
static_cast<float>(it->x),
218 static_cast<float>(it->y),
219 static_cast<float>(it->z)};
265 const bool all,
const std::vector<size_t>& idxs,
266 const float render_area_sqpixels)
const;
300 static constexpr
bool HAS_RGB =
false;
302 static constexpr
bool HAS_RGBf =
false;
304 static constexpr
bool HAS_RGBu8 =
false;
312 inline size_t size()
const {
return m_obj.
size(); }
318 template <
typename T>
321 const auto& pt = m_obj[idx];
342 template <
class POINTSMAP>
349 const size_t N = pc_src.size();
351 for (
size_t i = 0; i < N; i++)
354 pc_src.getPointXYZ(i, x, y, z);
355 pc_dst.setPointXYZ(i, x, y, z);
void resize(size_t N)
Set the number of points (with contents undefined)
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...
mrpt::img::TColorf m_colorFromDepth_max
void insertPoint(float x, float y, float z)
Adds a new point to the cloud.
void loadFromPointsMap(const POINTSMAP *themap)
Load the points from any other point map class supported by the adapter mrpt::opengl::PointCloudAdapt...
std::vector< mrpt::math::TPoint3Df > m_vertex_buffer_data
void enableColorFromX(bool v=true)
#define ASSERT_BELOW_(__A, __B)
void notifyChange() const
Call to enable calling renderUpdateBuffers() before the next render() rendering iteration.
An adapter to different kinds of point cloud object.
void loadFromPointsList(LISTOFPOINTS &pointsList)
Load the points from a list of mrpt::math::TPoint3D.
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).
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 setAllPoints(const std::vector< T > &x, const std::vector< T > &y, const std::vector< T > &z)
Set the list of (X,Y,Z) point coordinates, all at once, from three vectors with their coordinates...
void resize(const size_t N)
Set number of points (to uninitialized values)
void reserve(size_t N)
Like STL std::vector's reserve.
#define DEFINE_SCHEMA_SERIALIZABLE()
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
void clear()
Empty the list of points.
~CPointCloud() override=default
Private, virtual destructor: only can be deleted from smart pointers.
size_t m_last_rendered_count
void setDimensions(size_t height, size_t width)
Does nothing as of now.
void setGradientColors(const mrpt::img::TColorf &colorMin, const mrpt::img::TColorf &colorMax)
Sets the colors used as extremes when colorFromDepth is enabled.
size_t m_last_rendered_count_ongoing
void enableColorFromY(bool v=true)
bool m_pointSmooth
Default: false.
Template class that implements the data structure and algorithms for Octree-based efficient rendering...
std::vector< mrpt::math::TPoint3Df > & m_points
Actually, an alias for the base class shader container of points.
#define ASSERT_(f)
Defines an assertion mechanism.
An adapter to different kinds of point cloud object.
mrpt::opengl::CPointCloud & m_obj
CPointCloud()
Constructor.
const mrpt::math::TPoint3Df & getPoint3Df(size_t i) const
void enableColorFromZ(bool v=true)
const mrpt::math::TPoint3Df & operator[](size_t i) const
Read access to each individual point (checks for "i" in the valid range only in Debug).
const std::vector< mrpt::math::TPoint3Df > & getArrayPoints() const
Get a const reference to the internal array of points.
A virtual base class that implements the capability of exporting 3D point clouds and faces to a file ...
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 internal_render_one_point(size_t i) const
size_t PLY_export_get_face_count() const override
In a base class, return the number of faces.
float coords_t
The type of each point XYZ coordinates.
Renderizable generic renderer for objects using the points shader.
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.
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...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
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)
mrpt::img::TColorf m_col_slop
Color linear function slope.
void enablePointSmooth(bool enable=true)
bool isPointSmoothEnabled() const
void markAllPointsAsNew()
Do needed internal work if all points are new (octree rebuilt,...)
An RGBA color - floats in the range [0,1].
void setAllPointsFast(std::vector< mrpt::math::TPoint3Df > &pts)
Set the list of (X,Y,Z) point coordinates, DESTROYING the contents of the input vectors (via swap) ...
The namespace for 3D scene representation and rendering.
void octree_getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const
size_t PLY_export_get_vertex_count() const override
In a base class, return the number of vertices.
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...
mrpt::img::TColorf m_colorFromDepth_min
The colors used to interpolate when m_colorFromDepth is true.
void setPoint(size_t i, const float x, const float y, const float z)
Write an individual point (checks for "i" in the valid range only in Debug).
float m_min
Buffer for min/max coords when m_colorFromDepth is true.
void disablePointSmooth()
#define DEFINE_SERIALIZABLE(class_name, NS)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
void onUpdateBuffers_Points() override
Must be implemented in derived classes to update the geometric entities to be drawn in "m_*_buffer" f...
PointCloudAdapter(const mrpt::opengl::CPointCloud &obj)
Constructor (accept a const ref for convenience)
size_t getActuallyRendered() const
Get the number of elements actually rendered in the last render event.
size_t size() const
Get number of points.
A virtual base class that implements the capability of importing 3D point clouds and faces from a fil...
mrpt::img::TColorf m_col_slop_inv
void setInvalidPoint(const size_t idx)
Set XYZ coordinates of i'th point.
void getPointXYZ(const size_t idx, T &x, T &y, T &z) const
Get XYZ coordinates of i'th point.
A cloud of points, all with the same color or each depending on its value along a particular coordina...