Go to the documentation of this file.
13 #include <boost/graph/graph_traits.hpp>
14 #include <boost/graph/properties.hpp>
48 std::chrono::time_point< std::chrono::steady_clock > &time_start)
50 auto time_now = std::chrono::steady_clock::now();
51 std::chrono::duration< double > duration = time_now - time_start;
52 time_start = time_now;
54 return duration.count();
70 template<
typename HalfedgeGraph,
76 const GeometryTraits >,
bool only_pts)
79 typedef double coordP_type;
80 typedef double coordN_type;
81 typedef float coordC_type;
82 typedef float coordT_type;
83 typedef size_t index_type;
88 if(!boost::filesystem::exists(filename))
89 throw std::invalid_argument(
90 "read_mesh() -> input file path refer to no existing file.");
92 throw std::invalid_argument(
93 "read_mesh() -> input file path find without any extension.");
95 std::cout <<
"Generic reading of \""
99 std::vector< std::string > valid_extensions = {
100 ".obj",
".off",
".coff",
".ply",
".msh"};
101 std::vector< std::string > valid_vtk_extensions = {
".vtk",
".vtp",
".vtu"};
111 throw std::invalid_argument(
112 "read_mesh() -> input file extension can't be read (yet).");
124 bool obj_file =
false;
126 auto time = std::chrono::steady_clock::now();
134 mvr.vertex_color_coords,
136 mvr.texture_face_indices,
137 mvr.normal_face_indices,
149 mvr.vertex_color_coords,
151 mvr.face_color_coords);
159 mvr.vertex_color_coords,
161 mvr.texture_face_indices);
168 mvr.vertex_color_coords,
172 mvr.face_color_coords,
173 mvr.field_attributes,
184 mvr.vertex_color_coords,
188 mvr.face_color_coords,
189 mvr.field_attributes,
200 mvr.vertex_color_coords,
202 mvr.texture_face_indices,
203 mvr.normal_face_indices,
217 mvr.texture_coords.clear();
219 mvr.face_color_coords.clear();
220 mvr.lines_indices.clear();
221 mvr.faces_indices.clear();
222 mvr.texture_face_indices.clear();
223 mvr.normal_face_indices.clear();
224 mvr.points_colors.clear();
225 mvr.faces_colors.clear();
226 mvr.lines_colors.clear();
227 mvr.field_attributes.clear();
228 mvr.field_names.clear();
229 mvr.materials.clear();
230 mvr.face_material.clear();
233 unsigned int duplicated_vertices_nbr;
238 duplicated_vertices_nbr,
249 if(duplicated_vertices_nbr > 0)
251 std::cout <<
"read_mesh(): " << duplicated_vertices_nbr
252 <<
" vertices duplicated (non-manifold mesh)." << std::endl;
257 std::cout <<
"Generic reading of \""
259 <<
" in " << parsing_duration + populating_duration <<
"s"
260 <<
" (parsing " << parsing_duration <<
"s"
261 <<
", populating DS " << populating_duration <<
"s)."
276 template<
typename HalfedgeGraph,
281 GeometryTraits gt(g);
282 read_mesh< HalfedgeGraph, GeometryTraits >(filename, g, pmaps, gt, only_pts);
MeshFromVectorReprParameters & use_corner_texcoord(bool _use_corner_texcoord)
void read_ply_file(std::string file_path, std::vector< std::vector< CoordType > > &points_coords, std::vector< std::vector< CoordNType > > &normals_coords, std::vector< std::vector< CoordTType > > &texture_coords, std::vector< std::vector< CoordCType > > &vertex_color_coords, std::vector< std::vector< IndexType > > &face_indices, std::vector< std::vector< IndexType > > &texture_face_indices)
void read_vtk_or_vtp_or_vtu_file(std::string file_path, std::vector< std::vector< CoordType > > &points_coords, std::vector< std::vector< CoordNType > > &normals_coords, std::vector< std::vector< CoordCType > > &vertex_color_coords, std::vector< std::vector< IndexType > > &line_indices, std::vector< std::vector< CoordCType > > &lines_color_coords, std::vector< std::vector< IndexType > > &face_indices, std::vector< std::vector< CoordCType > > &face_color_coords, std::vector< std::vector< std::vector< double > > > &field_attributes, std::vector< std::string > &field_names, bool if_unstructured_grid_then_take_surface=false)
void mesh_from_vector_representation(HalfedgeGraph &g, FEVV::PMapsContainer &pmaps, unsigned int &dup_v_nbr, FEVV::Types::MVR< coordP_type, coordN_type, coordT_type, coordC_type, index_type > &mvr, MeshFromVectorReprParameters< HalfedgeGraph > const ¶ms, const GeometryTraits &)
Build the mesh from the given vector representation.
void read_fbx_file(const std::string &filePath, std::vector< std::vector< coord_type > > &points_coords, std::vector< std::vector< coordN_type > > &normals_coords, std::vector< std::vector< coordT_type > > &texture_coords, std::vector< std::vector< coordC_type > > &, std::vector< std::vector< index_type > > &face_indices, std::vector< std::vector< index_type > > &texture_face_indices, std::vector< std::vector< index_type > > &normal_face_indices, std::vector< material_type > &materials, std::vector< index_type > &face_material)
Read the FBX file and load its data into given parameters.
boost::graph_traits< MeshT >::edges_size_type size_of_edges(const MeshT &g)
Real current number of edges of the mesh. Generic version.
std::map< std::string, boost::any > PMapsContainer
std::string get_file_full_name(const std::string &file_name)
Interfaces for plugins These interfaces will be used for different plugins.
void read_off_file(std::string file_path, std::vector< std::vector< CoordType > > &points_coords, std::vector< std::vector< CoordNType > > &normals_coords, std::vector< std::vector< CoordTType > > &texture_coords, std::vector< std::vector< CoordCType > > &vertex_color_coords, std::vector< std::vector< IndexType > > &face_indices, std::vector< std::vector< CoordCType > > &face_color_coords)
double get_time_and_reset(std::chrono::time_point< std::chrono::steady_clock > &time_start)
Measure time since starting time and reset starting time.
void read_mesh(const std::string &filename, FEVV::CGALPointSet &g, PMapsContainer &pmaps, bool=false)
Load mesh from file.
void read_obj_file(const std::string &file_path, std::vector< std::vector< CoordType > > &points_coords, std::vector< std::vector< CoordNType > > &normals_coords, std::vector< std::vector< CoordTType > > &texture_coords, std::vector< std::vector< CoordCType > > &vertex_color_coords, std::vector< std::vector< IndexType > > &face_indices, std::vector< std::vector< IndexType > > &texture_face_indices, std::vector< std::vector< IndexType > > &normal_face_indices, std::vector< MaterialType > &materials, std::vector< IndexType > &face_material)
boost::graph_traits< MeshT >::faces_size_type size_of_faces(const MeshT &g)
Real current number of faces of the mesh. Generic version.
bool has_extension(const std::string &file_name)
bool read_gmsh_file(const std::string &file_path, std::vector< std::vector< CoordType > > &points_coords, std::vector< std::vector< CoordNType > > &normals_coords, std::vector< std::vector< CoordCType > > &vertex_color_coords, std::vector< std::vector< IndexType > > &line_indices, std::vector< std::vector< CoordCType > > &lines_color_coords, std::vector< std::vector< IndexType > > &face_indices, std::vector< std::vector< CoordCType > > &face_color_coords, std::vector< std::vector< std::vector< double > > > &field_attributes, std::vector< std::string > &field_names)
boost::graph_traits< MeshT >::vertices_size_type size_of_vertices(const MeshT &g)
Real current number of vertices of the mesh. Generic version.