27#include <easy3d/core/poly_mesh.h>
28#include <easy3d/fileio/poly_mesh_io.h>
29#include <easy3d/util/resource.h>
30#include <easy3d/util/initializer.h>
41int main(
int argc,
char** argv) {
46 const std::string file_name = resource::directory() +
"/data/sphere.plm";
47 PolyMesh* mesh = PolyMeshIO::load(file_name);
49 LOG(ERROR) <<
"failed to load model. Please make sure the file exists and format is correct.";
52 std::cout <<
"mesh loaded. " << std::endl;
53 std::cout <<
"\tvertices: " << mesh->
n_vertices() << std::endl;
54 std::cout <<
"\tedges: " << mesh->
n_edges() << std::endl;
55 std::cout <<
"\tfaces: " << mesh->
n_faces() << std::endl;
56 std::cout <<
"\tcells: " << mesh->
n_cells() << std::endl;
63 const std::string save_file_name =
"./sphere-copy.plm";
64 if (PolyMeshIO::save(save_file_name, mesh))
65 std::cout <<
"mesh saved to \'" << save_file_name <<
"\'" << std::endl;
67 std::cerr <<
"failed create the new file" << std::endl;
Data structure representing a polyhedral mesh.
Definition: poly_mesh.h:50
unsigned int n_faces() const
returns number of faces in the mesh
Definition: poly_mesh.h:774
unsigned int n_edges() const
returns number of edges in the mesh
Definition: poly_mesh.h:770
unsigned int n_cells() const
returns number of cells in the mesh
Definition: poly_mesh.h:776
unsigned int n_vertices() const
returns number of vertices in the mesh
Definition: poly_mesh.h:768
Definition: collider.cpp:182
void initialize(bool use_log_file, bool use_setting_file, const std::string &resource_dir)
Initialization of Easy3D.
Definition: initializer.cpp:35