class mp2p_icp::pointcloud_t¶
Overview¶
Generic container of pointcloud(s), and/or extracted features. More…
#include <pointcloud.h> class pointcloud_t: public CSerializable, public std::enable_shared_from_this< pointcloud_t > { public: // fields static constexpr const char* PT_LAYER_RAW = "raw"; static constexpr const char* PT_LAYER_PLANE_CENTROIDS = "plane_centroids"; std::map<layer_name_t, mrpt::maps::CPointsMap::Ptr> point_layers; std::vector<mrpt::math::TLine3D> lines; std::vector<plane_patch_t> planes; std::optional<uint64_t> id; std::optional<std::string> label; // methods virtual bool empty() const; virtual size_t size() const; virtual size_t size_points_only() const; virtual std::string contents_summary() const; virtual void clear(); bool save_to_file(const std::string& fileName) const; bool load_from_file(const std::string& fileName); virtual auto get_visualization(const render_params_t& p = render_params_t()) const; virtual void merge_with( const pointcloud_t& otherPc, const std::optional<mrpt::math::TPose3D>& otherRelativePose = std::nullopt ); void get_visualization_planes(mrpt::opengl::CSetOfObjects& o, const render_params_planes_t& p) const; void get_visualization_lines(mrpt::opengl::CSetOfObjects& o, const render_params_lines_t& p) const; void get_visualization_points(mrpt::opengl::CSetOfObjects& o, const render_params_points_t& p) const; Ptr get_shared_from_this(); Ptr get_shared_from_this_or_clone(); ConstPtr get_shared_from_this() const; ConstPtr get_shared_from_this_or_clone() const; static void get_visualization_point_layer( mrpt::opengl::CSetOfObjects& o, const render_params_point_layer_t& p, const mrpt::maps::CPointsMap::Ptr& pts ); };
Detailed Documentation¶
Generic container of pointcloud(s), and/or extracted features.
Can be derived by users to define custom point cloud features, for use in custom alignment algorithms.
The class supports C++11/C++17 std::shared_from_this() via get_shared_from_this();
Fields¶
std::map<layer_name_t, mrpt::maps::CPointsMap::Ptr> point_layers
Different point layers, indexed by a descriptive name. Known layer names: See section above.
- PT_LAYER_RAW: reserved to the original, full point cloud (if kept)
- PT_LAYER_PLANE_CENTROIDS: a point for each plane in
planes
(same order).
std::vector<mrpt::math::TLine3D> lines
3D lines (infinite lines, not segments)
std::vector<plane_patch_t> planes
Plane patches=centroid point + infinite plane
std::optional<uint64_t> id
An optional numerical ID to identify the pointcloud in some higher-level system. Used to build the names of ICP debug files, if so requested. It is not mandatory and even duplicates may exist without problems: just a placeholder for the user of this library to use it.
std::optional<std::string> label
An optional textual identification/description of the pointcloud in some higher-level system. Used to build the names of ICP debug files, if so requested. It is not mandatory and even duplicates may exist without problems: just a placeholder for the user of this library to use it.
Methods¶
virtual bool empty() const
return true if all point cloud layers, feature lists, etc. are empty
virtual size_t size() const
Overall number of elements (points, lines, planes)
virtual size_t size_points_only() const
Overall number of points, including all layers.
virtual std::string contents_summary() const
Returns a string summarizing all the elements in the container (points, lines, planes)
virtual void clear()
clear all containers
bool save_to_file(const std::string& fileName) const
Saves the pointcloud_t object to file, using MRPT serialization and using on-the-fly GZIP compression.
Returns:
true on success.
bool load_from_file(const std::string& fileName)
Loads the pointcloud_t object from a file. See ()
Returns:
true on success.
virtual auto get_visualization(const render_params_t& p = render_params_t()) const
Gets a renderizable view of all geometric entities.
See render_params_t for options to show/hide the different geometric entities and point layers.
If deriving user classes inheriting from pointcloud_t, remember to reimplement this method and call this base class method to render common elements.
Gets a renderizable view of all planes
virtual void merge_with( const pointcloud_t& otherPc, const std::optional<mrpt::math::TPose3D>& otherRelativePose = std::nullopt )
Merges all geometric entities from another point cloud into this one, with an optional relative pose transformation.
Point layers will be merged for coinciding names, or created if the layer did not exist in this
.
This method is virtual for user-extended point clouds can handle other geometric primitives as needed.
void get_visualization_planes(mrpt::opengl::CSetOfObjects& o, const render_params_planes_t& p) const
Used inside get_visualization(), renders planes only.
void get_visualization_lines(mrpt::opengl::CSetOfObjects& o, const render_params_lines_t& p) const
Used inside get_visualization(), renders lines only.
void get_visualization_points(mrpt::opengl::CSetOfObjects& o, const render_params_points_t& p) const
Used inside get_visualization(), renders points only.
Ptr get_shared_from_this()
Returns a shared_ptr to this object, if it was already created initially as a shared_ptr, or an empty pointer otherwise.
Ptr get_shared_from_this_or_clone()
Like get_shared_from_this(), or makes a deep copy if the original object was allocated in the stack, etc.
static void get_visualization_point_layer( mrpt::opengl::CSetOfObjects& o, const render_params_point_layer_t& p, const mrpt::maps::CPointsMap::Ptr& pts )
Used inside get_visualization_points(), renders points only.