Easy3D 2.5.3
easy3d::io Namespace Reference

File input/output functionalities. More...

Classes

class  Element
 Model element (e.g., faces, vertices, edges) with optional properties. More...
 
class  GenericProperty
 Generic property. More...
 
class  LineInputStream
 Input stream class to operate on ASCII files. More...
 
class  PlyReader
 A general purpose PLY file reader. More...
 
class  PlyWriter
 A general purpose PLY file writer. More...
 
class  PointCloudIO_ptx
 Implementation of file input/output operations for ASCII Cyclone point cloud export format (PTX). More...
 
class  PointCloudIO_vg
 Implementation of file input/output operations for vertex group (VG) format PointCloud. More...
 

Typedefs

typedef GenericProperty< vec3Vec3Property
 
typedef GenericProperty< vec2Vec2Property
 
typedef GenericProperty< float > FloatProperty
 
typedef GenericProperty< int > IntProperty
 
typedef GenericProperty< std::vector< float > > FloatListProperty
 
typedef GenericProperty< std::vector< int > > IntListProperty
 

Functions

bool load_ply (const std::string &file_name, Graph *graph)
 Loads graph from a PLY file file_name. More...
 
bool save_ply (const std::string &file_name, const Graph *graph, bool binary=true)
 Saves graph into a PLY file file_name. More...
 
bool save_ppm (const std::string &file_name, const std::vector< unsigned char > &bits, int width, int height)
 
bool save_bmp (const std::string &file_name, const std::vector< unsigned char > &bits, int width, int height)
 
bool save_tga (const std::string &file_name, const std::vector< unsigned char > &bits, int width, int height)
 
bool is_big_endian ()
 returns endianness of the system.
 
bool load_bin (const std::string &file_name, PointCloud *cloud)
 Reads point cloud from a bin format file. More...
 
bool save_bin (const std::string &file_name, const PointCloud *cloud)
 Saves a point cloud to a bin format file. More...
 
bool load_xyz (const std::string &file_name, PointCloud *cloud)
 Reads point cloud from an xyz format file. More...
 
bool save_xyz (const std::string &file_name, const PointCloud *cloud)
 
bool load_bxyz (const std::string &file_name, PointCloud *cloud)
 Reads point cloud from a binary xyz format file.
 
bool save_bxyz (const std::string &file_name, const PointCloud *cloud)
 Saves a point cloud to a binary xyz format file.
 
bool load_ply (const std::string &file_name, PointCloud *cloud)
 Reads point cloud from a ply format file.
 
bool save_ply (const std::string &file_name, const PointCloud *cloud, bool binary=true)
 Saves a point cloud to a ply format file.
 
bool load_las (const std::string &file_name, PointCloud *cloud)
 Reads point cloud from an las/laz format file. Internally the method uses the LASlib of marti.nosp@m.n.is.nosp@m.enbur.nosp@m.g@ra.nosp@m.pidla.nosp@m.sso..nosp@m.com. See http://rapidlasso.com.
 
bool save_las (const std::string &file_name, const PointCloud *cloud)
 Saves a point cloud to an LAS/LAS format file. More...
 
bool load_pm (const std::string &file_name, PolyMesh *mesh)
 Reads a polyhedral mesh from a PM format file. This is the built-in binary format of Easy3D.
 
bool save_pm (const std::string &file_name, const PolyMesh *mesh)
 Saves a polyhedral mesh to a PM format file. This is the built-in binary format of Easy3D.
 
bool load_plm (const std::string &file_name, PolyMesh *mesh)
 Reads a polyhedral mesh from a PLM format file. This is the built-in ASCII format of Easy3D.
 
bool save_plm (const std::string &file_name, const PolyMesh *mesh)
 Saves a polyhedral mesh to a PLM format file. This is the built-in ASCII format of Easy3D.
 
bool load_mesh (const std::string &file_name, PolyMesh *mesh)
 Reads a polyhedral mesh from a MESH format file. This ASCII format is supported by Tetgen and Medit.
 
bool save_mesh (const std::string &file_name, const PolyMesh *mesh)
 Saves a polyhedral mesh to a MESH format file. This ASCII format is supported by Tetgen and Medit.
 
bool load_sm (const std::string &file_name, SurfaceMesh *mesh)
 Reads a surface mesh from a SM format file. More...
 
bool save_sm (const std::string &file_name, const SurfaceMesh *mesh)
 Saves a surface mesh to a SM format file.
 
bool load_ply (const std::string &file_name, SurfaceMesh *mesh)
 Reads a surface mesh from a PLY format file.
 
bool save_ply (const std::string &file_name, const SurfaceMesh *mesh, bool binary=true)
 Saves a surface mesh to a PLY format file.
 
bool load_off (const std::string &file_name, SurfaceMesh *mesh)
 Reads a surface mesh from a OFF format file.
 
bool save_off (const std::string &file_name, const SurfaceMesh *mesh)
 Saves a surface mesh to a OFF format file.
 
bool load_obj (const std::string &file_name, SurfaceMesh *mesh)
 Reads a surface mesh from a OBJ format file. More...
 
bool save_obj (const std::string &file_name, const SurfaceMesh *mesh)
 Saves a surface mesh to a OBJ format file.
 
bool load_stl (const std::string &file_name, SurfaceMesh *mesh)
 Reads a surface mesh from a STL format file.
 
bool save_stl (const std::string &file_name, const SurfaceMesh *mesh)
 Saves a surface mesh to a STL format file.
 
bool load_trilist (const std::string &file_name, SurfaceMesh *mesh)
 
bool load_geojson (const std::string &file_name, SurfaceMesh *mesh)
 

Detailed Description

File input/output functionalities.

TODO: Translator not implemented.

Function Documentation

◆ load_bin()

bool load_bin ( const std::string &  file_name,
PointCloud cloud 
)

Reads point cloud from a bin format file.

A typical bin format file contains three blocks storing points, colors (optional), and normals (optional).

◆ load_geojson()

bool load_geojson ( const std::string &  file_name,
SurfaceMesh mesh 
)

Reads Geojson format files. 2D polygons are stored as faces of a 3D surface mesh (all Z-coordinates are set to 0).

Reads Geojson format files using the single header file JSON library: https://github.com/nlohmann/json 2D polygons are stored as faces of a 3D surface mesh (all Z-coordinates are set to 0).

◆ load_obj()

bool load_obj ( const std::string &  file_name,
SurfaceMesh mesh 
)

Reads a surface mesh from a OBJ format file.

TODO: Translator not implemented.

◆ load_ply()

bool load_ply ( const std::string &  file_name,
Graph graph 
)

Loads graph from a PLY file file_name.

Returns
The status of the operation
  • true if succeeded
  • false if failed

◆ load_sm()

bool load_sm ( const std::string &  file_name,
SurfaceMesh mesh 
)

Reads a surface mesh from a SM format file.

TODO: Translator not implemented.

◆ load_trilist()

bool load_trilist ( const std::string &  file_name,
SurfaceMesh mesh 
)

Reads a set of triangles (each line has coordinates of 3 points) Mainly used for easily saving triangles for debugging.

◆ load_xyz()

bool easy3d::io::load_xyz ( const std::string &  file_name,
PointCloud cloud 
)

Reads point cloud from an xyz format file.

Each line of an xyz file contains three floating point numbers representing the x, y, and z coordinates of a point.

◆ save_bin()

bool save_bin ( const std::string &  file_name,
const PointCloud cloud 
)

Saves a point cloud to a bin format file.

A typical bin format file contains three blocks storing points, colors (optional), and normals (optional).

◆ save_bmp()

bool save_bmp ( const std::string &  file_name,
const std::vector< unsigned char > &  bits,
int  width,
int  height 
)
Attention
This function assumes that each pixel has 4 channels in BGRA order.

◆ save_las()

bool easy3d::io::save_las ( const std::string &  file_name,
const PointCloud cloud 
)

Saves a point cloud to an LAS/LAS format file.

Internally it uses the LASlib of marti.nosp@m.n.is.nosp@m.enbur.nosp@m.g@ra.nosp@m.pidla.nosp@m.sso..nosp@m.com. See http://rapidlasso.com

◆ save_ply()

bool save_ply ( const std::string &  file_name,
const Graph graph,
bool  binary = true 
)

Saves graph into a PLY file file_name.

Parameters
file_nameThe full path of the file.
graphThe graph.
binarytrue for binary format, otherwise ASCII format.
Returns
The status of the operation
  • true if succeeded
  • false if failed

◆ save_ppm()

bool save_ppm ( const std::string &  file_name,
const std::vector< unsigned char > &  bits,
int  width,
int  height 
)

Some image IO functions I wrote years ago. Just want to keep them.

Attention
These functions assumes specific input storage.
This function assumes that each pixel has 3 channels in RGB order.

◆ save_tga()

bool save_tga ( const std::string &  file_name,
const std::vector< unsigned char > &  bits,
int  width,
int  height 
)
Attention
This function assumes that each pixel has 4 channels in BGRA order.