Class CPointCloudColoured

Inheritance Relationships

Base Types

Class Documentation

class CPointCloudColoured : public virtual mrpt::viz::CVisualObject, public mrpt::viz::VisualObjectParams_Points, public mrpt::viz::PLY_Importer, public mrpt::viz::PLY_Exporter

A cloud of points, each one with an individual color (R,G,B,A).

To load from a points-map, CPointCloudColoured::loadFromPointsMap().

../../output_staging/generated/doxygen/xml/preview_CPointCloudColoured.png

See also

opengl::Scene, opengl::CPointCloud

Read/Write of the list of points to render

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 insertPoint(const mrpt::math::TPointXYZfRGBAu8 &p)

inserts a new point

inline void resize(size_t N)

Set the number of points, with undefined contents

inline void reserve(size_t N)

Like STL std::vector’s reserve

inline const mrpt::math::TPoint3Df &getPoint3Df(size_t i) const

NOTE: This method is intentionally not protected by the shared_mutex, since it’s called in the inner loops of the octree, which acquires the lock once.

void setPoint(size_t i, const mrpt::math::TPointXYZfRGBAu8 &p)

Write an individual point (checks for “i” in the valid range only in Debug).

inline void setPoint_fast(size_t i, const mrpt::math::TPointXYZfRGBAu8 &p)

Like setPoint() but does not check for index out of bounds

inline void setPoint_fast(size_t i, const float x, const float y, const float z)

Like setPoint() but does not check for index out of bounds

inline void setPointColor_fast(size_t index, float R, float G, float B, float A = 1)

Like setPointColor but without checking for out-of-index errors

inline void setPointColor_u8_fast(size_t index, uint8_t r, uint8_t g, uint8_t b, uint8_t a = 0xff)
inline void setAllPointsAlpha(uint8_t alpha_channel)

Overwrites the alpha (transparency) channel for all existing points

inline void getPointColor_fast(size_t index, float &R, float &G, float &B) const

Like getPointColor but without checking for out-of-index errors

inline void getPointColor_fast(size_t index, uint8_t &r, uint8_t &g, uint8_t &b) const
inline mrpt::img::TColor getPointColor(size_t index) const
inline size_t size() const

Return the number of points

inline size_t size_unprotected() const

Like size(), but without locking the data mutex (internal usage)

inline bool empty() const
inline void clear()

Erase all the points

template<class POINTSMAP>
void loadFromPointsMap(const POINTSMAP *themap)

Load the points from any other point map class supported by the adapter mrpt::viz::PointCloudAdapter.

inline size_t getActuallyRendered() const

Get the number of elements actually rendered in the last render event.

Modify the appearance of the rendered points

void recolorizeByCoordinate(float coord_min, float coord_max, int coord_index = 2, 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.

PLY Import virtual methods to implement in base classes

virtual void PLY_import_set_vertex_count(size_t N) override

In a base class, reserve memory to prepare subsequent calls to PLY_import_set_vertex

inline void PLY_import_set_face_count([[maybe_unused]] size_t N) override

In a base class, reserve memory to prepare subsequent calls to PLY_import_set_face

inline void PLY_import_set_vertex_timestamp([[maybe_unused]] size_t idx, [[maybe_unused]] const double unixTimestamp) override
virtual void PLY_import_set_vertex(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.

Parameters:

pt_color – Will be nullptr if the loaded file does not provide color info.

PLY Export virtual methods to implement in base classes

virtual size_t PLY_export_get_vertex_count() const override

In a base class, return the number of vertices

inline virtual size_t PLY_export_get_face_count() const override

In a base class, return the number of faces

virtual void PLY_export_get_vertex(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.

Parameters:

pt_color – Will be nullptr if the loaded file does not provide color info.

Public Functions

CPointCloudColoured()
void markAllPointsAsNew()
virtual auto internalBoundingBoxLocal() const -> mrpt::math::TBoundingBoxf override

Must be implemented by derived classes to provide the updated bounding box in the object local frame of coordinates. This will be called only once after each time the derived class reports to notifyChange() that the object geometry changed.

See also

getBoundingBox(), getBoundingBoxLocal(), getBoundingBoxLocalf()

virtual void toYAMLMap(mrpt::containers::yaml &propertiesMap) const override

Used from Scene::asYAML().

Note

(New in MRPT 2.4.2)