From b084e9059d0b87932c552e5ca329bf9368ee454c Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Mon, 15 Jun 2020 15:59:52 +0200 Subject: [PATCH] WIP --- BGL/examples/BGL_OpenMesh/TriMesh.cpp | 9 ++++--- .../surface_mesh_partition.cpp | 11 +++----- .../Point_set_3/point_set_read_xyz.cpp | 4 +-- .../test/Point_set_3/point_set_test.cpp | 8 +++--- .../average_spacing_example.cpp | 8 +++--- .../bilateral_smooth_point_set_example.cpp | 8 +++--- .../edge_aware_upsample_point_set_example.cpp | 7 ++--- .../Point_set_processing_3/edges_example.cpp | 6 ++--- .../grid_simplification_example.cpp | 6 ++--- .../hierarchy_simplification_example.cpp | 6 ++--- .../normal_estimation.cpp | 11 +++----- .../normals_example.cpp | 6 ++--- .../random_simplification_example.cpp | 6 ++--- .../read_write_xyz_point_set_example.cpp | 14 +++++----- .../registration_with_OpenGR.cpp | 16 ++++------- ...tion_with_opengr_pointmatcher_pipeline.cpp | 20 +++++--------- .../registration_with_pointmatcher.cpp | 20 +++++--------- .../remove_outliers_example.cpp | 8 +++--- .../scale_estimation_example.cpp | 6 ++--- .../structuring_example.cpp | 6 ++--- ...plify_and_regularize_point_set_example.cpp | 5 ++-- .../poisson_reconstruction.cpp | 9 +++---- .../poisson_reconstruction_example.cpp | 9 +++---- .../poisson_reconstruction_function.cpp | 8 +++--- .../poisson_reconstruction_test.cpp | 10 +++---- .../orient_polygon_soup_example.cpp | 5 ++-- .../polyfit_example_with_region_growing.cpp | 6 ++--- .../polyfit_example_without_input_planes.cpp | 6 ++--- .../Polyhedron/Plugins/IO/GOCAD_io_plugin.cpp | 2 +- .../Polyhedron/Plugins/IO/STL_io_plugin.cpp | 20 +++++++------- .../Polyhedron/Scene_polygon_soup_item.cpp | 2 +- .../demo/Polyhedron/Scene_polygon_soup_item.h | 2 +- .../examples/Ridges_3/Ridges_Umbilics_LCC.cpp | 3 ++- ...icient_RANSAC_and_plane_regularization.cpp | 8 +++--- .../efficient_RANSAC_basic.cpp | 14 +++++----- .../efficient_RANSAC_with_callback.cpp | 14 +++++----- .../efficient_RANSAC_with_custom_shape.cpp | 7 +++-- .../efficient_RANSAC_with_parameters.cpp | 8 +++--- .../efficient_RANSAC_with_point_access.cpp | 8 +++--- .../shape_detection_basic_deprecated.cpp | 12 ++++----- Stream_support/include/CGAL/IO/3MF.h | 4 +-- .../include/CGAL/IO/VRML/VRML_1_ostream.h | 4 +-- ...gmentation_from_sdf_values_LCC_example.cpp | 4 +-- .../edge_collapse_linear_cell_complex.cpp | 4 +-- .../MCF_Skeleton_LCC_example.cpp | 4 +-- .../simple_mcfskel_LCC_example.cpp | 4 +-- .../demo/Triangulation_3/Scene.cpp | 27 ++----------------- 47 files changed, 150 insertions(+), 245 deletions(-) diff --git a/BGL/examples/BGL_OpenMesh/TriMesh.cpp b/BGL/examples/BGL_OpenMesh/TriMesh.cpp index dfadaaaeb8a..126ba82744f 100644 --- a/BGL/examples/BGL_OpenMesh/TriMesh.cpp +++ b/BGL/examples/BGL_OpenMesh/TriMesh.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include @@ -26,14 +26,15 @@ int main(int argc, char** argv ) Mesh mesh; std::vector V; - std::ifstream in((argc>1)?argv[1]:"in.off"); - CGAL::read_OFF(in, mesh); + const char* filename = (argc>1)?argv[1]:"in.off"; + const char* outname= (argc>2)?argv[2]:"out.off"; + CGAL::read_polygon_mesh(filename, mesh); for(vertex_descriptor vd : vertices(mesh)){ for(halfedge_descriptor hd : CGAL::halfedges_around_target(vd,mesh)){ if(! CGAL::is_border(edge(hd,mesh),mesh)){ CGAL::Euler::flip_edge(hd,mesh); - CGAL::write_OFF((argc>2)?argv[2]:"out.off", mesh); + CGAL::write_polygon_mesh(outname, mesh); return 0; } } diff --git a/BGL/examples/BGL_surface_mesh/surface_mesh_partition.cpp b/BGL/examples/BGL_surface_mesh/surface_mesh_partition.cpp index 40dd8c6766a..3abe54c8953 100644 --- a/BGL/examples/BGL_surface_mesh/surface_mesh_partition.cpp +++ b/BGL/examples/BGL_surface_mesh/surface_mesh_partition.cpp @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include @@ -13,16 +13,11 @@ typedef CGAL::Surface_mesh SM; int main(int argc, char** argv) { - std::ifstream in((argc>1) ? argv[1] : "data/blobby.off"); + const char* filename = (argc>1)?argv[1]:"data/blobby.off"; int number_of_parts = (argc>2) ? atoi(argv[2]) : 8; - if(!in) { - std::cerr << "Error: could not read input file" << std::endl; - return EXIT_FAILURE; - } - SM sm; - CGAL::read_OFF(in, sm); + CGAL::read_polygon_mesh(filename, sm); // The vertex <--> partition_id property map typedef SM::Property_map Vertex_id_map; diff --git a/Point_set_3/examples/Point_set_3/point_set_read_xyz.cpp b/Point_set_3/examples/Point_set_3/point_set_read_xyz.cpp index 3bf3823d865..88a09b850de 100644 --- a/Point_set_3/examples/Point_set_3/point_set_read_xyz.cpp +++ b/Point_set_3/examples/Point_set_3/point_set_read_xyz.cpp @@ -14,12 +14,12 @@ typedef CGAL::Point_set_3 Point_set; int main (int argc, char** argv) { - std::ifstream f (argc > 1 ? argv[1] : "data/oni.xyz"); + const char* fname (argc > 1 ? argv[1] : "data/oni.xyz"); Point_set point_set; // Reading input in XYZ format - if (!f || !CGAL::read_XYZ(f, point_set)) + if (!CGAL::read_point_set(fname, point_set)) { std::cerr << "Can't read input file " << std::endl; return EXIT_FAILURE; diff --git a/Point_set_3/test/Point_set_3/point_set_test.cpp b/Point_set_3/test/Point_set_3/point_set_test.cpp index 9d9a806252a..ba569186107 100644 --- a/Point_set_3/test/Point_set_3/point_set_test.cpp +++ b/Point_set_3/test/Point_set_3/point_set_test.cpp @@ -1,7 +1,7 @@ #include #include -#include +#include #include #include @@ -36,10 +36,8 @@ int main (int, char**) point_set.add_normal_map(); test (point_set.has_normal_map(), "point set should have normals."); - std::ifstream f ("data/oni.pwn"); - CGAL::read_XYZ(f, point_set); - - f.close (); + const char* fname ("data/oni.pwn"); + CGAL::read_point_set(fname, point_set); Point_set::iterator first_to_remove = CGAL::grid_simplify_point_set (point_set, diff --git a/Point_set_processing_3/examples/Point_set_processing_3/average_spacing_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/average_spacing_example.cpp index 993459de097..a72a8d10c6a 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/average_spacing_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/average_spacing_example.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include @@ -26,10 +26,8 @@ int main(int argc, char*argv[]) // we use a property map that accesses the 1st element of the tuple. std::vector points; - std::ifstream stream(fname); - if (!stream || - !CGAL::read_XYZ( - stream, std::back_inserter(points), + if (!CGAL::read_points( + fname, std::back_inserter(points), CGAL::parameters::point_map(CGAL::Nth_of_tuple_property_map<1,IndexedPointWithColorTuple>()))) { std::cerr << "Error: cannot read file " << fname << std::endl; diff --git a/Point_set_processing_3/examples/Point_set_processing_3/bilateral_smooth_point_set_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/bilateral_smooth_point_set_example.cpp index 74de4c82636..5b3d492110b 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/bilateral_smooth_point_set_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/bilateral_smooth_point_set_example.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include #include @@ -26,10 +26,8 @@ int main(int argc, char*argv[]) // Reads a .xyz point set file in points[] * with normals *. std::vector points; - std::ifstream stream(input_filename); - if (!stream || - !CGAL::read_XYZ(stream, - std::back_inserter(points), + if (!CGAL::read_points(input_filename, + std::back_inserter(points), CGAL::parameters::point_map(CGAL::First_of_pair_property_map()). normal_map(CGAL::Second_of_pair_property_map()))) { diff --git a/Point_set_processing_3/examples/Point_set_processing_3/edge_aware_upsample_point_set_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/edge_aware_upsample_point_set_example.cpp index 3fc83a9f858..270436a332a 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/edge_aware_upsample_point_set_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/edge_aware_upsample_point_set_example.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include @@ -25,10 +25,7 @@ int main(int argc, char* argv[]) // Reads a .xyz point set file in points[], *with normals*. std::vector points; - std::ifstream stream(input_filename); - - if (!stream || - !CGAL::read_XYZ(stream, + if (!CGAL::read_points(input_filename, std::back_inserter(points), CGAL::parameters::point_map(CGAL::First_of_pair_property_map()). normal_map(CGAL::Second_of_pair_property_map()))) diff --git a/Point_set_processing_3/examples/Point_set_processing_3/edges_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/edges_example.cpp index a7b90c3ce2d..8b7ae295287 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/edges_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/edges_example.cpp @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include // defines std::pair #include @@ -22,9 +22,7 @@ typedef std::array Covariance; int main (int , char**) { // Reads a .xyz point set file in points[]. std::list points; - std::ifstream stream("data/fandisk.off"); - if (!stream || - !CGAL::read_OFF(stream, + if (!CGAL::read_points("data/fandisk.off", std::back_inserter(points), CGAL::parameters::point_map(CGAL::First_of_pair_property_map()))) { diff --git a/Point_set_processing_3/examples/Point_set_processing_3/grid_simplification_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/grid_simplification_example.cpp index 1d50d712561..b2f27d6b6a3 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/grid_simplification_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/grid_simplification_example.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include @@ -14,9 +14,7 @@ int main(int argc, char*argv[]) // Reads a .xyz point set file in points[]. std::vector points; const char* fname = (argc>1)?argv[1]:"data/oni.xyz"; - std::ifstream stream(fname); - if (!stream || - !CGAL::read_XYZ(stream, std::back_inserter(points))) + if (!CGAL::read_points(fname, std::back_inserter(points))) { std::cerr << "Error: cannot read file " << fname << std::endl; return EXIT_FAILURE; diff --git a/Point_set_processing_3/examples/Point_set_processing_3/hierarchy_simplification_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/hierarchy_simplification_example.cpp index 544c8db4597..a491907df97 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/hierarchy_simplification_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/hierarchy_simplification_example.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include #include @@ -17,9 +17,7 @@ int main(int argc, char*argv[]) // Reads a .xyz point set file in points[]. std::vector points; const char* fname = (argc>1)?argv[1]:"data/oni.xyz"; - std::ifstream stream(fname); - if (!stream || - !CGAL::read_XYZ(stream, std::back_inserter(points))) + if (!CGAL::read_points(fname, std::back_inserter(points))) { std::cerr << "Error: cannot read file " << fname << std::endl; return EXIT_FAILURE; diff --git a/Point_set_processing_3/examples/Point_set_processing_3/normal_estimation.cpp b/Point_set_processing_3/examples/Point_set_processing_3/normal_estimation.cpp index 281bbd12d54..bf5a4883b1d 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/normal_estimation.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/normal_estimation.cpp @@ -20,8 +20,7 @@ #include #include #include -#include -#include +#include #include #include // defines std::pair @@ -252,9 +251,7 @@ int main(int argc, char * argv[]) std::string extension = input_filename.substr(input_filename.find_last_of('.')); if (extension == ".off" || extension == ".OFF") { - std::ifstream stream(input_filename.c_str()); - success = stream && - CGAL::read_OFF(stream, + success = CGAL::read_points(input_filename.c_str(), std::back_inserter(points), CGAL::parameters::point_map(CGAL::First_of_pair_property_map())); } @@ -262,9 +259,7 @@ int main(int argc, char * argv[]) else if (extension == ".xyz" || extension == ".XYZ" || extension == ".pwn" || extension == ".PWN") { - std::ifstream stream(input_filename.c_str()); - success = stream && - CGAL::read_XYZ(stream, + success = CGAL::read_points(input_filename.c_str(), std::back_inserter(points), CGAL::parameters::point_map(CGAL::First_of_pair_property_map())); } diff --git a/Point_set_processing_3/examples/Point_set_processing_3/normals_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/normals_example.cpp index c327343d6db..0fdacc3cd10 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/normals_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/normals_example.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include // defines std::pair #include @@ -25,9 +25,7 @@ int main(int argc, char*argv[]) const char* fname = (argc>1)?argv[1]:"data/sphere_1k.xyz"; // Reads a .xyz point set file in points[]. std::list points; - std::ifstream stream(fname); - if (!stream || - !CGAL::read_XYZ(stream, + if (!CGAL::read_points(fname, std::back_inserter(points), CGAL::parameters::point_map(CGAL::First_of_pair_property_map()))) { diff --git a/Point_set_processing_3/examples/Point_set_processing_3/random_simplification_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/random_simplification_example.cpp index 06bb83eb0e3..72af7fa0f80 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/random_simplification_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/random_simplification_example.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include @@ -16,9 +16,7 @@ int main(int argc, char*argv[]) const char* fname = (argc>1)?argv[1]:"data/oni.xyz"; // Reads a .xyz point set file in points[]. std::vector points; - std::ifstream stream(fname); - if (!stream || - !CGAL::read_XYZ(stream, std::back_inserter(points))) + if (!CGAL::read_points(fname, std::back_inserter(points))) { std::cerr << "Error: cannot read file " << fname << std::endl; return EXIT_FAILURE; diff --git a/Point_set_processing_3/examples/Point_set_processing_3/read_write_xyz_point_set_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/read_write_xyz_point_set_example.cpp index e453ff88ef4..119fcdc12a0 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/read_write_xyz_point_set_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/read_write_xyz_point_set_example.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include // defines std::pair @@ -20,16 +20,14 @@ int main(int argc, char*argv[]) { const char* fname = (argc>1)?argv[1]:"data/oni.xyz"; // Reads a .xyz point set file in points[]. - // Note: read_XYZ() requires an output iterator + // Note: read_points() requires an output iterator // over points and as well as property maps to access each // point position and normal. std::vector points; - std::ifstream in(fname); - if (!in || - !CGAL::read_XYZ( - in,std::back_inserter(points), - CGAL::parameters::point_map (CGAL::First_of_pair_property_map()). - normal_map (CGAL::Second_of_pair_property_map()))) + if (!CGAL::read_points(fname, + std::back_inserter(points), + CGAL::parameters::point_map (CGAL::First_of_pair_property_map()). + normal_map (CGAL::Second_of_pair_property_map()))) { std::cerr << "Error: cannot read file " << fname << std::endl; return EXIT_FAILURE; diff --git a/Point_set_processing_3/examples/Point_set_processing_3/registration_with_OpenGR.cpp b/Point_set_processing_3/examples/Point_set_processing_3/registration_with_OpenGR.cpp index 453ab216e21..3249d2058dd 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/registration_with_OpenGR.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/registration_with_OpenGR.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include @@ -25,27 +25,21 @@ int main(int argc, const char** argv) const char* fname2 = (argc>2)?argv[2]:"data/hippo2.ply"; std::vector pwns1, pwns2; - std::ifstream input(fname1); - if (!input || - !CGAL::read_PLY(input, std::back_inserter(pwns1), - CGAL::parameters::point_map (CGAL::First_of_pair_property_map()). - normal_map (Normal_map()))) + if (!CGAL::read_points(fname1, std::back_inserter(pwns1), + CGAL::parameters::point_map (CGAL::First_of_pair_property_map()). + normal_map (Normal_map()))) { std::cerr << "Error: cannot read file " << fname1 << std::endl; return EXIT_FAILURE; } - input.close(); - input.open(fname2); - if (!input || - !CGAL::read_PLY(input, std::back_inserter(pwns2), + if (!CGAL::read_points(fname2, std::back_inserter(pwns2), CGAL::parameters::point_map (Point_map()). normal_map (Normal_map()))) { std::cerr << "Error: cannot read file " << fname2 << std::endl; return EXIT_FAILURE; } - input.close(); // EITHER call the registration method Super4PCS from OpenGR to get the transformation to apply to pwns2 // std::pair res = diff --git a/Point_set_processing_3/examples/Point_set_processing_3/registration_with_opengr_pointmatcher_pipeline.cpp b/Point_set_processing_3/examples/Point_set_processing_3/registration_with_opengr_pointmatcher_pipeline.cpp index 173a9b601d3..d5e42db205f 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/registration_with_opengr_pointmatcher_pipeline.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/registration_with_opengr_pointmatcher_pipeline.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include #include @@ -28,27 +28,21 @@ int main(int argc, const char** argv) const char* fname2 = (argc>2)?argv[2]:"data/hippo2.ply"; std::vector pwns1, pwns2; - std::ifstream input(fname1); - if (!input || - !CGAL::read_PLY(input, std::back_inserter(pwns1), - CGAL::parameters::point_map (CGAL::First_of_pair_property_map()). - normal_map (Normal_map()))) + if (!CGAL::read_points(fname1, std::back_inserter(pwns1), + CGAL::parameters::point_map (CGAL::First_of_pair_property_map()). + normal_map (Normal_map()))) { std::cerr << "Error: cannot read file " << fname1 << std::endl; return EXIT_FAILURE; } - input.close(); - input.open(fname2); - if (!input || - !CGAL::read_PLY(input, std::back_inserter(pwns2), - CGAL::parameters::point_map (Point_map()). - normal_map (Normal_map()))) + if (!CGAL::read_points(fname2, std::back_inserter(pwns2), + CGAL::parameters::point_map (Point_map()). + normal_map (Normal_map()))) { std::cerr << "Error: cannot read file " << fname2 << std::endl; return EXIT_FAILURE; } - input.close(); std::cerr << "Computing registration transformation using OpenGR Super4PCS.." << std::endl; // First, compute registration transformation using OpenGR Super4PCS diff --git a/Point_set_processing_3/examples/Point_set_processing_3/registration_with_pointmatcher.cpp b/Point_set_processing_3/examples/Point_set_processing_3/registration_with_pointmatcher.cpp index 20abbd3cd9b..864d421eded 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/registration_with_pointmatcher.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/registration_with_pointmatcher.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include #include @@ -28,27 +28,21 @@ int main(int argc, const char** argv) const char* fname2 = (argc>2)?argv[2]:"data/hippo2.ply"; std::vector pwns1, pwns2; - std::ifstream input(fname1); - if (!input || - !CGAL::read_PLY(input, std::back_inserter(pwns1), - CGAL::parameters::point_map (CGAL::First_of_pair_property_map()). - normal_map (Normal_map()))) + if (!CGAL::read_points(fname1, std::back_inserter(pwns1), + CGAL::parameters::point_map (CGAL::First_of_pair_property_map()). + normal_map (Normal_map()))) { std::cerr << "Error: cannot read file " << fname1 << std::endl; return EXIT_FAILURE; } - input.close(); - input.open(fname2); - if (!input || - !CGAL::read_PLY(input, std::back_inserter(pwns2), - CGAL::parameters::point_map (Point_map()). - normal_map (Normal_map()))) + if (!CGAL::read_points(fname2, std::back_inserter(pwns2), + CGAL::parameters::point_map (Point_map()). + normal_map (Normal_map()))) { std::cerr << "Error: cannot read file " << fname2 << std::endl; return EXIT_FAILURE; } - input.close(); // // Prepare ICP config diff --git a/Point_set_processing_3/examples/Point_set_processing_3/remove_outliers_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/remove_outliers_example.cpp index d8b36a253a5..caadef5aa25 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/remove_outliers_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/remove_outliers_example.cpp @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include #include @@ -18,10 +18,8 @@ int main(int argc, char*argv[]) // Reads a .xyz point set file in points[]. // The Identity_property_map property map can be omitted here as it is the default value. std::vector points; - std::ifstream stream(fname); - if (!stream || - !CGAL::read_XYZ(stream, std::back_inserter(points), - CGAL::parameters::point_map(CGAL::Identity_property_map()))) + if (!CGAL::read_points(fname, std::back_inserter(points), + CGAL::parameters::point_map(CGAL::Identity_property_map()))) { std::cerr << "Error: cannot read file " << fname << std::endl; return EXIT_FAILURE; diff --git a/Point_set_processing_3/examples/Point_set_processing_3/scale_estimation_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/scale_estimation_example.cpp index 6533ff1038d..4d10ad09d02 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/scale_estimation_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/scale_estimation_example.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include @@ -27,11 +27,9 @@ int main (int argc, char** argv) CGAL::Timer task_timer; std::vector points; - std::ifstream stream(fname); // read input - if (!(stream - && CGAL::read_XYZ(stream, std::back_inserter(points)))) + if (!CGAL::read_points(fname, std::back_inserter(points))) { std::cerr << "Error: can't read input file" << std::endl; return EXIT_FAILURE; diff --git a/Point_set_processing_3/examples/Point_set_processing_3/structuring_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/structuring_example.cpp index 2e282da9559..eafe6a3ce6b 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/structuring_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/structuring_example.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include @@ -30,10 +30,8 @@ int main (int argc, char** argv) Pwn_vector points; // Loading point set from a file. - std::ifstream stream(argc>1 ? argv[1] : "data/cube.pwn"); - if (!stream || - !CGAL::read_XYZ(stream, + if (!CGAL::read_points((argc>1 ? argv[1] : "data/cube.pwn"), std::back_inserter(points), CGAL::parameters::point_map(Point_map()). normal_map(Normal_map()))) diff --git a/Point_set_processing_3/examples/Point_set_processing_3/wlop_simplify_and_regularize_point_set_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/wlop_simplify_and_regularize_point_set_example.cpp index c8fe1296a08..d81e664257b 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/wlop_simplify_and_regularize_point_set_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/wlop_simplify_and_regularize_point_set_example.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #include #include @@ -21,9 +21,8 @@ int main(int argc, char** argv) // Reads a .xyz point set file in points[] std::vector points; - std::ifstream stream(input_filename); - if (!stream || !CGAL::read_XYZ(stream, std::back_inserter(points))) + if (!CGAL::read_points(input_filename, std::back_inserter(points))) { std::cerr << "Error: cannot read file " << input_filename << std::endl; diff --git a/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/poisson_reconstruction.cpp b/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/poisson_reconstruction.cpp index 14635c7b7b0..6f8d8e52f88 100644 --- a/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/poisson_reconstruction.cpp +++ b/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/poisson_reconstruction.cpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include @@ -185,12 +185,11 @@ int main(int argc, char * argv[]) extension == ".pwn" || extension == ".PWN") { // Reads the point set file in points[]. - // Note: read_XYZ() requires an iterator over points + // Note: read_points() requires an iterator over points // + property maps to access each point's position and normal. - std::ifstream stream(input_filename.c_str()); if (!stream || - !CGAL::read_XYZ( - stream, + !CGAL::read_points( + input_filename.c_str(), std::back_inserter(points), CGAL::parameters::point_map (CGAL::make_first_of_pair_property_map(Point_with_normal())). diff --git a/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/poisson_reconstruction_example.cpp b/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/poisson_reconstruction_example.cpp index d5c6d8a3958..645e438aed2 100644 --- a/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/poisson_reconstruction_example.cpp +++ b/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/poisson_reconstruction_example.cpp @@ -6,7 +6,7 @@ #include #include #include -#include +#include #include #include @@ -40,13 +40,12 @@ int main(void) FT sm_distance = 0.375; // Surface Approximation error w.r.t. point set average spacing. // Reads the point set file in points[]. - // Note: read_XYZ() requires an iterator over points + // Note: read_points() requires an iterator over points // + property maps to access each point's position and normal. PointList points; - std::ifstream stream("data/kitten.xyz"); if (!stream || - !CGAL::read_XYZ( - stream, + !CGAL::read_points( + "data/kitten.xyz", std::back_inserter(points), CGAL::parameters::point_map (Point_map()). normal_map (Normal_map()))) diff --git a/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/poisson_reconstruction_function.cpp b/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/poisson_reconstruction_function.cpp index 9ab6134548b..9a35d61e0c1 100644 --- a/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/poisson_reconstruction_function.cpp +++ b/Poisson_surface_reconstruction_3/examples/Poisson_surface_reconstruction_3/poisson_reconstruction_function.cpp @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include #include @@ -16,10 +16,10 @@ typedef CGAL::Polyhedron_3 Polyhedron; int main(void) { std::vector points; - std::ifstream stream("data/kitten.xyz"); + if (!stream || - !CGAL::read_XYZ( - stream, + !CGAL::read_points( + "data/kitten.xyz", std::back_inserter(points), CGAL::parameters::point_map(CGAL::First_of_pair_property_map()). normal_map(CGAL::Second_of_pair_property_map()))) diff --git a/Poisson_surface_reconstruction_3/test/Poisson_surface_reconstruction_3/poisson_reconstruction_test.cpp b/Poisson_surface_reconstruction_3/test/Poisson_surface_reconstruction_3/poisson_reconstruction_test.cpp index 697dad1fa53..e84e3e8ed42 100644 --- a/Poisson_surface_reconstruction_3/test/Poisson_surface_reconstruction_3/poisson_reconstruction_test.cpp +++ b/Poisson_surface_reconstruction_3/test/Poisson_surface_reconstruction_3/poisson_reconstruction_test.cpp @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include @@ -135,13 +135,11 @@ int main(int argc, char * argv[]) extension == ".pwn" || extension == ".PWN") { // Reads the point set file in points[]. - // Note: read_XYZ() requires an iterator over points + // Note: read_points() requires an iterator over points // + property maps to access each point's position and normal. // The position property map can be omitted here as we use iterators over Point_3 elements. - std::ifstream stream(input_filename.c_str()); - if (!stream || - !CGAL::read_XYZ( - stream, + if (!CGAL::read_points( + input_filename.c_str(), std::back_inserter(points), CGAL::parameters::normal_map (CGAL::make_normal_of_point_with_normal_map(PointList::value_type())) diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/orient_polygon_soup_example.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/orient_polygon_soup_example.cpp index fd5b66a914f..49cc2711c2f 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/orient_polygon_soup_example.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/orient_polygon_soup_example.cpp @@ -7,7 +7,7 @@ #include #include -#include +#include #include #include @@ -19,12 +19,11 @@ typedef CGAL::Polyhedron_3 Polyhedron; int main(int argc, char* argv[]) { const char* filename = (argc > 1) ? argv[1] : "data/tet-shuffled.off"; - std::ifstream input(filename); std::vector points; std::vector > polygons; - if(!input || !CGAL::read_OFF(input, points, polygons) || points.empty()) + if(!CGAL::read_polygon_soup(filename, points, polygons) || points.empty()) { std::cerr << "Cannot open file " << std::endl; return EXIT_FAILURE; diff --git a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_with_region_growing.cpp b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_with_region_growing.cpp index 4478e2e9cd4..73981738bb3 100644 --- a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_with_region_growing.cpp +++ b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_with_region_growing.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include #include @@ -96,12 +96,12 @@ int main() std::cerr << "Failed open file \'" << input_file << "\'" << std::endl; return EXIT_FAILURE; } + input_stream.close(); std::cout << "Loading point cloud: " << input_file << "..."; CGAL::Timer t; t.start(); - if (!input_stream || - !CGAL::read_XYZ(input_stream, + if (!CGAL::read_points(input_file.c_str(), std::back_inserter(points), CGAL::parameters::point_map(Point_map()).normal_map(Normal_map()))) { diff --git a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_without_input_planes.cpp b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_without_input_planes.cpp index c2a4c11066d..0cbe5d2375f 100644 --- a/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_without_input_planes.cpp +++ b/Polygonal_surface_reconstruction/examples/Polygonal_surface_reconstruction/polyfit_example_without_input_planes.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include #include #include @@ -63,12 +63,12 @@ int main() std::cerr << "failed open file \'" <(); } - + in.close(); CGAL::Timer t; t.start(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/IO/STL_io_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/IO/STL_io_plugin.cpp index 9c4beebceb3..4ed82ddf492 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/IO/STL_io_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/IO/STL_io_plugin.cpp @@ -1,13 +1,13 @@ +#include "SMesh_type.h" #include "Scene_surface_mesh_item.h" #include "Scene_polygon_soup_item.h" #include "Kernel_type.h" #include "Scene.h" -#include "SMesh_type.h" #include #include -#include +#include #include #include @@ -65,6 +65,7 @@ load(QFileInfo fileinfo, bool& ok, bool add_to_scene){ ok = false; return QList(); } + in.close(); if(fileinfo.size() == 0) { CGAL::Three::Three::warning( tr("The file you are trying to load is empty.")); @@ -75,9 +76,9 @@ load(QFileInfo fileinfo, bool& ok, bool add_to_scene){ CGAL::Three::Three::scene()->addItem(item); return QList()< > points; - std::vector > triangles; - if (!CGAL::read_STL(in, points, triangles)) + std::vector points; + std::vector > triangles; + if (!CGAL::read_polygon_soup(fileinfo.filePath().toUtf8().toStdString(), points, triangles)) { std::cerr << "Error: invalid STL file" << std::endl; ok = false; @@ -90,11 +91,10 @@ load(QFileInfo fileinfo, bool& ok, bool add_to_scene){ SMesh* SM = new SMesh(); if (CGAL::Polygon_mesh_processing::is_polygon_soup_a_polygon_mesh(triangles)) { - auto pmap = boost::make_function_property_map, Point_3>( - [](const std::array& a) { return Point_3(a[0], a[1], a[2]); }); - CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh(points, triangles, *SM, - CGAL::parameters::point_map(pmap), - CGAL::parameters::all_default()); + //auto pmap = boost::make_function_property_map, Point_3>( + // [](const std::array& a) { return Point_3(a[0], a[1], a[2]); }); + + CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh(points, triangles, *SM); } if(!SM->is_valid() || SM->is_empty()){ diff --git a/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item.cpp b/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item.cpp index 5d7f920bea4..bf3ea636e0f 100644 --- a/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item.cpp @@ -661,7 +661,7 @@ Scene_polygon_soup_item::new_triangle(const std::size_t i, d->soup->polygons.push_back(new_polygon); } -template +template void Scene_polygon_soup_item::load(const std::vector& points, const std::vector& polygons) { if(!d->soup) diff --git a/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item.h b/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item.h index 52630451b04..a9bbbc29ca6 100644 --- a/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item.h +++ b/Polyhedron/demo/Polyhedron/Scene_polygon_soup_item.h @@ -113,7 +113,7 @@ public: Scene_polygon_soup_item* clone() const Q_DECL_OVERRIDE; - template + template void load(const std::vector& points, const std::vector& polygons); template diff --git a/Ridges_3/examples/Ridges_3/Ridges_Umbilics_LCC.cpp b/Ridges_3/examples/Ridges_3/Ridges_Umbilics_LCC.cpp index 31900442aee..247a6badd3d 100644 --- a/Ridges_3/examples/Ridges_3/Ridges_Umbilics_LCC.cpp +++ b/Ridges_3/examples/Ridges_3/Ridges_Umbilics_LCC.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #if defined(CGAL_USE_BOOST_PROGRAM_OPTIONS) && ! defined(DONT_USE_BOOST_PROGRAM_OPTIONS) #include @@ -286,7 +287,7 @@ int main() //load the model from PolyhedralSurf P; - CGAL::read_OFF(if_name.c_str(), P); + CGAL::read_polygon_mesh(if_name.c_str(), P); fprintf(stderr, "loadMesh %d Ves %d Facets\n", (int)num_vertices(P), (int)num_faces(P)); if(verbose) diff --git a/Shape_detection/examples/Shape_detection/efficient_RANSAC_and_plane_regularization.cpp b/Shape_detection/examples/Shape_detection/efficient_RANSAC_and_plane_regularization.cpp index 8beefa68341..aa7022bbcf4 100644 --- a/Shape_detection/examples/Shape_detection/efficient_RANSAC_and_plane_regularization.cpp +++ b/Shape_detection/examples/Shape_detection/efficient_RANSAC_and_plane_regularization.cpp @@ -7,7 +7,7 @@ #include #include -#include +#include #include #include @@ -29,11 +29,9 @@ typedef CGAL::Shape_detection::Plane Plane; int main(int argc, char** argv) { Pwn_vector points; - std::ifstream stream(argc > 1 ? argv[1] : "data/cube.pwn"); - if (!stream || - !CGAL::read_XYZ( - stream, + if (!CGAL::read_points( + (argc > 1 ? argv[1] : "data/cube.pwn"), std::back_inserter(points), CGAL::parameters::point_map(Point_map()). normal_map(Normal_map()))) { diff --git a/Shape_detection/examples/Shape_detection/efficient_RANSAC_basic.cpp b/Shape_detection/examples/Shape_detection/efficient_RANSAC_basic.cpp index 3a12ab771a2..548229e42b6 100644 --- a/Shape_detection/examples/Shape_detection/efficient_RANSAC_basic.cpp +++ b/Shape_detection/examples/Shape_detection/efficient_RANSAC_basic.cpp @@ -7,7 +7,7 @@ #include #include -#include +#include #include #include @@ -34,14 +34,12 @@ int main (int argc, char** argv) { Pwn_vector points; // Load point set from a file. - std::ifstream stream(filename); - if (!stream || - !CGAL::read_XYZ( - stream, - std::back_inserter(points), - CGAL::parameters::point_map(Point_map()). - normal_map(Normal_map()))) { + if (!CGAL::read_points( + filename, + std::back_inserter(points), + CGAL::parameters::point_map(Point_map()). + normal_map(Normal_map()))) { std::cerr << "Error: cannot read file cube.pwn!" << std::endl; return EXIT_FAILURE; diff --git a/Shape_detection/examples/Shape_detection/efficient_RANSAC_with_callback.cpp b/Shape_detection/examples/Shape_detection/efficient_RANSAC_with_callback.cpp index 324b538fba2..2a946a3c312 100644 --- a/Shape_detection/examples/Shape_detection/efficient_RANSAC_with_callback.cpp +++ b/Shape_detection/examples/Shape_detection/efficient_RANSAC_with_callback.cpp @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include @@ -61,14 +61,12 @@ int main (int argc, char** argv) { const char* filename = (argc > 1) ? argv[1] : "data/cube.pwn"; Pwn_vector points; - std::ifstream stream(filename); - if (!stream || - !CGAL::read_XYZ( - stream, - std::back_inserter(points), - CGAL::parameters::point_map(Point_map()). - normal_map(Normal_map()))) { + if (!CGAL::read_points( + filename, + std::back_inserter(points), + CGAL::parameters::point_map(Point_map()). + normal_map(Normal_map()))) { std::cerr << "Error: cannot read file cube.pwn!" << std::endl; return EXIT_FAILURE; diff --git a/Shape_detection/examples/Shape_detection/efficient_RANSAC_with_custom_shape.cpp b/Shape_detection/examples/Shape_detection/efficient_RANSAC_with_custom_shape.cpp index 0b7449275db..a5e46c4e74c 100644 --- a/Shape_detection/examples/Shape_detection/efficient_RANSAC_with_custom_shape.cpp +++ b/Shape_detection/examples/Shape_detection/efficient_RANSAC_with_custom_shape.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include @@ -27,11 +27,10 @@ int main(int argc, char** argv) { Pwn_vector points; // Load point set from a file. - std::ifstream stream((argc > 1) ? argv[1] : "data/cube.pwn"); if (!stream || - !CGAL::read_XYZ( - stream, + !CGAL::read_points( + ((argc > 1) ? argv[1] : "data/cube.pwn"), std::back_inserter(points), CGAL::parameters::point_map(Point_map()). normal_map(Normal_map()))) { diff --git a/Shape_detection/examples/Shape_detection/efficient_RANSAC_with_parameters.cpp b/Shape_detection/examples/Shape_detection/efficient_RANSAC_with_parameters.cpp index 68558643372..18da3c0fa59 100644 --- a/Shape_detection/examples/Shape_detection/efficient_RANSAC_with_parameters.cpp +++ b/Shape_detection/examples/Shape_detection/efficient_RANSAC_with_parameters.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include @@ -31,11 +31,9 @@ int main(int argc, char** argv) { Pwn_vector points; // Load point set from a file. - std::ifstream stream((argc > 1) ? argv[1] : "data/cube.pwn"); - if (!stream || - !CGAL::read_XYZ( - stream, + if (!CGAL::read_points( + ((argc > 1) ? argv[1] : "data/cube.pwn"), std::back_inserter(points), CGAL::parameters::point_map(Point_map()). normal_map(Normal_map()))) { diff --git a/Shape_detection/examples/Shape_detection/efficient_RANSAC_with_point_access.cpp b/Shape_detection/examples/Shape_detection/efficient_RANSAC_with_point_access.cpp index 13a38364d37..1feda5d0684 100644 --- a/Shape_detection/examples/Shape_detection/efficient_RANSAC_with_point_access.cpp +++ b/Shape_detection/examples/Shape_detection/efficient_RANSAC_with_point_access.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include @@ -28,11 +28,9 @@ int main(int argc, char** argv) { Pwn_vector points; // Load point set from a file. - std::ifstream stream((argc > 1) ? argv[1] : "data/cube.pwn"); - if (!stream || - !CGAL::read_XYZ( - stream, + if (!CGAL::read_points( + ((argc > 1) ? argv[1] : "data/cube.pwn"), std::back_inserter(points), CGAL::parameters::point_map(Point_map()). normal_map(Normal_map()))) { diff --git a/Shape_detection/examples/Shape_detection/shape_detection_basic_deprecated.cpp b/Shape_detection/examples/Shape_detection/shape_detection_basic_deprecated.cpp index bfda11a6658..db53ce3c8de 100644 --- a/Shape_detection/examples/Shape_detection/shape_detection_basic_deprecated.cpp +++ b/Shape_detection/examples/Shape_detection/shape_detection_basic_deprecated.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include @@ -40,13 +40,11 @@ int run(const char* filename) { // Load a point set from a file. // read_XYZ takes an OutputIterator for storing the points // and a property map to store the normal vector with each point. - std::ifstream stream(filename); - if (!stream || - !CGAL::read_XYZ(stream, - std::back_inserter(points), - CGAL::parameters::point_map(Point_map()). - normal_map(Normal_map()))) { + if (!CGAL::read_points(filename, + std::back_inserter(points), + CGAL::parameters::point_map(Point_map()). + normal_map(Normal_map()))) { std::cout << "Error: cannot read the file cube.pwn" << std::endl; return EXIT_FAILURE; diff --git a/Stream_support/include/CGAL/IO/3MF.h b/Stream_support/include/CGAL/IO/3MF.h index 9bde7f7f2e5..16d191c3eaf 100644 --- a/Stream_support/include/CGAL/IO/3MF.h +++ b/Stream_support/include/CGAL/IO/3MF.h @@ -475,7 +475,7 @@ bool write_triangle_soups_to_3mf(const std::string& fname, } // convenience -template +template bool write_triangle_soup_to_3mf(const std::string& fname, const PointRange& points, const PolygonRange& polygons, @@ -488,7 +488,7 @@ bool write_triangle_soup_to_3mf(const std::string& fname, return write_triangle_soups_to_3mf(fname, all_points, all_polygons, names); } -template +template bool write_3MF(const std::string& fname, const PointRange& points, const PolygonRange& polygons) diff --git a/Stream_support/include/CGAL/IO/VRML/VRML_1_ostream.h b/Stream_support/include/CGAL/IO/VRML/VRML_1_ostream.h index ec2b135a027..f86400c7e6d 100644 --- a/Stream_support/include/CGAL/IO/VRML/VRML_1_ostream.h +++ b/Stream_support/include/CGAL/IO/VRML/VRML_1_ostream.h @@ -80,8 +80,8 @@ operator<<(VRML_1_ostream& os, << oformat(CGAL::to_double(t[1].z())) << " ,\n" << Indent << " " << oformat(CGAL::to_double(t[2].x())) << " " - << oformat(CGAL::to_double(t[2].y()) << " " - << oformat(CGAL::to_double(t[2].z()) << " ,\n" + << oformat(CGAL::to_double(t[2].y())) << " " + << oformat(CGAL::to_double(t[2].z())) << " ,\n" << Indent << " " << oformat(CGAL::to_double(t[3].x())) << " " << oformat(CGAL::to_double(t[3].y())) << " " diff --git a/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/segmentation_from_sdf_values_LCC_example.cpp b/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/segmentation_from_sdf_values_LCC_example.cpp index 1b15e6624c3..1ff8786ad70 100644 --- a/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/segmentation_from_sdf_values_LCC_example.cpp +++ b/Surface_mesh_segmentation/examples/Surface_mesh_segmentation/segmentation_from_sdf_values_LCC_example.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include #include @@ -20,7 +20,7 @@ int main() { // create and read LCC LCC mesh; - CGAL::read_OFF("data/cactus.off", mesh); + CGAL::read_polygon_mesh("data/cactus.off", mesh); // create a property-map for SDF values typedef CGAL::Unique_hash_map Facet_double_map; diff --git a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_linear_cell_complex.cpp b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_linear_cell_complex.cpp index 72b4805f852..69d0df8396d 100644 --- a/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_linear_cell_complex.cpp +++ b/Surface_mesh_simplification/examples/Surface_mesh_simplification/edge_collapse_linear_cell_complex.cpp @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include @@ -24,7 +24,7 @@ int main(int argc, char** argv) LCC lcc; const char* filename = (argc > 1) ? argv[1] : "data/cube-meshed.off"; std::ifstream is(filename); - if(!CGAL::read_OFF(filename, lcc)) + if(!CGAL::read_polygon_mesh(filename, lcc)) { std::cerr << "Failed to read input mesh: " << filename << std::endl; return EXIT_FAILURE; diff --git a/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/MCF_Skeleton_LCC_example.cpp b/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/MCF_Skeleton_LCC_example.cpp index 50cb9a36cbf..07ebd30f0dd 100644 --- a/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/MCF_Skeleton_LCC_example.cpp +++ b/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/MCF_Skeleton_LCC_example.cpp @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include @@ -24,7 +24,7 @@ typedef Skeleton::edge_descriptor Skeleton_edge; int main() { LCC lcc; - CGAL::read_OFF("data/elephant.off", lcc); + CGAL::read_polygon_mesh("data/elephant.off", lcc); Skeleton skeleton; Skeletonization mcs(lcc); diff --git a/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/simple_mcfskel_LCC_example.cpp b/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/simple_mcfskel_LCC_example.cpp index 8c14e8a450f..37d9e744d85 100644 --- a/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/simple_mcfskel_LCC_example.cpp +++ b/Surface_mesh_skeletonization/examples/Surface_mesh_skeletonization/simple_mcfskel_LCC_example.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include @@ -53,7 +53,7 @@ struct Display_polylines{ int main() { LCC lcc; - CGAL::read_OFF("data/elephant.off", lcc); + CGAL::read_polygon_mesh("data/elephant.off", lcc); Skeleton skeleton; diff --git a/Triangulation_3/demo/Triangulation_3/Scene.cpp b/Triangulation_3/demo/Triangulation_3/Scene.cpp index 5afeead6a6a..6dd328495b0 100644 --- a/Triangulation_3/demo/Triangulation_3/Scene.cpp +++ b/Triangulation_3/demo/Triangulation_3/Scene.cpp @@ -5,9 +5,8 @@ #include #include -#include +#include #include -#include #include #include @@ -102,20 +101,6 @@ void Scene::loadPointsOFF(const char* filename) /* 1. use CGAL::File_scanner_OFF to read in data --tested */ readOFFPointsandFacets( filename, pts ); - /* 2. use CGAL::read_OFF to read in data -- tested */ - /* Note: read in points only, i.e. normals and faces are ignored */ - /* Note: this function can NOT omit comments (starting with '#') */ -// ifstream fin; -// fin.open( filename ); - // check whether the file is opened properly -// if( !fin ) { -// showError( QObject::tr("Error: cannot open file %1 for reading.").arg(filename) ); -// return; -// } -// if ( !CGAL::read_OFF( fin, // inout ifstream -// back_inserter(pts) ) ) { // output iterator over points -// showError( QObject::tr("Error: cannot read file %1.").arg(filename) ); -// } /* Insert the points to build a Delaunay triangulation */ /* Note: this function returns the number of inserted points; @@ -139,19 +124,11 @@ void Scene::loadPointsOFF(const char* filename) void Scene::loadPointsXYZ(const char* filename) { - ifstream fin; - fin.open( filename ); - // Check whether the file is opened properly - if( !fin ) { - showError( QObject::tr("Error: cannot open file %1 for reading.").arg(filename) ); - return; - } - /* Use CGAL::read_XYZ to read in data -- tested */ /* Note: this function reads in points only (normals are ignored) */ /* Note: this function can NOT omit comments (starting with '#') */ list pts; - if( !CGAL::read_XYZ( fin, // input ifstream + if( !CGAL::read_points( filename, // input ifstream back_inserter(pts) ) ) { // output iterator over points showError( QObject::tr("Error: cannot read file %1.").arg(filename) ); }