Class PLY_Exporter

Inheritance Relationships

Derived Types

Class Documentation

class PLY_Exporter

A virtual base class that implements the capability of exporting 3D point clouds and faces to a file in the Stanford PLY format.

See also

PLY_Importer

Subclassed by mrpt::viz::CPointCloud, mrpt::viz::CPointCloudColoured

PLY Export virtual methods to implement in base classes

virtual size_t PLY_export_get_vertex_count() const = 0

In a base class, return the number of vertices

virtual size_t PLY_export_get_face_count() const = 0

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 = 0

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

virtual ~PLY_Exporter() = default
bool saveToPlyFile(const std::string &filename, bool save_in_binary = false, const std::vector<std::string> &file_comments = std::vector<std::string>(), const std::vector<std::string> &file_obj_info = std::vector<std::string>()) const

Saves to a PLY file.

Parameters:
  • filename[in] The filename to be saved.

  • file_comments[in] If provided (!=nullptr) the list of comment strings stored in the file will be returned.

  • file_obj_info[in]

    If provided (!=nullptr) the list of “object

    info” strings stored in the file will be returned.

Returns:

false on any error writing the file. To obtain more details on the error you can call getSavePLYErrorString()

inline std::string getSavePLYErrorString() const

Return a description of the error if loadFromPlyFile() returned false, or an empty string if the file was loaded without problems.