diff --git a/Point_set_3/examples/Point_set_3/draw_point_set_3.cpp b/Point_set_3/examples/Point_set_3/draw_point_set_3.cpp index 07cd0ed8776..701eb615f9c 100644 --- a/Point_set_3/examples/Point_set_3/draw_point_set_3.cpp +++ b/Point_set_3/examples/Point_set_3/draw_point_set_3.cpp @@ -1,7 +1,8 @@ #include + #include -#include #include + #include typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; @@ -12,14 +13,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* filename = argc > 1 ? argv[1] : "data/oni.xyz"; Point_set point_set; - // Reading input in XYZ format - if (!f || !CGAL::read_point_set(f, point_set)) + if(!CGAL::read_point_set(filename, point_set)) { - std::cerr<<"Can't read input file " - <<(argc > 1 ? argv[1] : "data/oni.xyz")<< std::endl; + std::cerr << "Can't read input file " << filename << std::endl; return EXIT_FAILURE; } diff --git a/Point_set_3/examples/Point_set_3/point_set_advanced.cpp b/Point_set_3/examples/Point_set_3/point_set_advanced.cpp index 85b06934c0b..8b30e2bbbaa 100644 --- a/Point_set_3/examples/Point_set_3/point_set_advanced.cpp +++ b/Point_set_3/examples/Point_set_3/point_set_advanced.cpp @@ -14,18 +14,18 @@ typedef CGAL::Point_set_3 Point_set; int main (int argc, char** argv) { - std::ifstream f (argc > 1 ? argv[1] : "data/camel.off"); + const char* filename = argc > 1 ? argv[1] : "data/camel.off"; Point_set point_set; point_set.add_normal_map(); // Reading input in OFF format - if (!f || !CGAL::read_point_set(f, point_set.index_back_inserter(), // OutputIterator - CGAL::parameters::point_map(point_set.point_push_map()) - .normal_map(point_set.normal_push_map()))) - { - std::cerr << "Can't read input file " << std::endl; - return EXIT_FAILURE; - } + if(!CGAL::read_point_set(filename, point_set.index_back_inserter(), + CGAL::parameters::point_map(point_set.point_push_map()) + .normal_map(point_set.normal_push_map()))) + { + std::cerr << "Can't read input file " << std::endl; + return EXIT_FAILURE; + } return EXIT_SUCCESS; } diff --git a/Point_set_3/examples/Point_set_3/point_set_algo.cpp b/Point_set_3/examples/Point_set_3/point_set_algo.cpp index 0ac1c31a1ae..12c98682475 100644 --- a/Point_set_3/examples/Point_set_3/point_set_algo.cpp +++ b/Point_set_3/examples/Point_set_3/point_set_algo.cpp @@ -35,7 +35,6 @@ int main (int, char**) for (std::size_t i = 0; i < nb_pts; ++ i) point_set.insert (*(generator ++)); - // Add normal property and estimate normal values point_set.add_normal_map(); CGAL::jet_estimate_normals @@ -44,7 +43,6 @@ int main (int, char**) point_set.parameters(). // Named parameters provided by Point_set_3 degree_fitting(2)); // additional named parameter specific to jet_estimate_normals - // Simplify point set CGAL::grid_simplify_point_set (point_set, diff --git a/Point_set_3/examples/Point_set_3/point_set_property.cpp b/Point_set_3/examples/Point_set_3/point_set_property.cpp index ddbaabc43bf..80e48a223d6 100644 --- a/Point_set_3/examples/Point_set_3/point_set_property.cpp +++ b/Point_set_3/examples/Point_set_3/point_set_property.cpp @@ -23,17 +23,17 @@ void print_point_set (const Point_set& point_set) boost::tie (intensity, boost::tuples::ignore) = point_set.property_map("intensity"); std::cerr << "Content of point set:" << std::endl; - for (Point_set::const_iterator it = point_set.begin(); - it != point_set.end(); ++ it) + for (Point_set::const_iterator it = point_set.begin(); it != point_set.end(); ++ it) + { std::cerr << "* Point " << point_set.point(*it) // or point_set[it] << " with color [" << (int)(color[*it][0]) << " " << (int)(color[*it][1]) << " " << (int)(color[*it][2]) << "] and intensity " << intensity[*it] << std::endl; + } } - int main (int, char**) { Point_set point_set; @@ -51,26 +51,26 @@ int main (int, char**) point_set.reserve (10); // For memory optimization for (std::size_t i = 0; i < 10; ++ i) - { - Point_set::iterator it = point_set.insert (Point (double(i), double(i), double(i))); - Color c = {{ (unsigned char)(CGAL::get_default_random().get_int(0, 255)), - (unsigned char)(CGAL::get_default_random().get_int(0, 255)), - (unsigned char)(CGAL::get_default_random().get_int(0, 255)) }}; - color[*it] = c; - intensity[*it] = rand() / (double)(RAND_MAX); - } + { + Point_set::iterator it = point_set.insert (Point (double(i), double(i), double(i))); + Color c = {{ (unsigned char)(CGAL::get_default_random().get_int(0, 255)), + (unsigned char)(CGAL::get_default_random().get_int(0, 255)), + (unsigned char)(CGAL::get_default_random().get_int(0, 255)) }}; + color[*it] = c; + intensity[*it] = rand() / (double)(RAND_MAX); + } print_point_set (point_set); // Remove points with intensity less than 0.5 Point_set::iterator it = point_set.begin(); while (it != point_set.end()) - { - if (intensity[*it] < 0.5) - point_set.remove(it); - else - ++ it; - } + { + if (intensity[*it] < 0.5) + point_set.remove(it); + else + ++ it; + } print_point_set (point_set); // point set is filtered diff --git a/Point_set_3/examples/Point_set_3/point_set_read_ply.cpp b/Point_set_3/examples/Point_set_3/point_set_read_ply.cpp index 7e4db2aa151..f6d86c9e389 100644 --- a/Point_set_3/examples/Point_set_3/point_set_read_ply.cpp +++ b/Point_set_3/examples/Point_set_3/point_set_read_ply.cpp @@ -1,6 +1,6 @@ #include + #include -#include #include #include @@ -19,9 +19,10 @@ int main (int argc, char** argv) Point_set point_set; - if (!f || !CGAL::read_PLY (f, point_set)) // same as `f >> point_set` + if(!CGAL::read_PLY (f, point_set)) // same as `f >> point_set` { std::cerr << "Can't read input file " << std::endl; + return EXIT_FAILURE; } // Shows which properties are defined 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 93b9454ea3a..7184af60db7 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,35 +14,31 @@ typedef CGAL::Point_set_3 Point_set; int main (int argc, char** argv) { - const char* fname (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 (!CGAL::read_point_set(fname, point_set)) - { - std::cerr << "Can't read input file " << std::endl; - return EXIT_FAILURE; - } + if(!CGAL::read_point_set(fname, point_set)) + { + std::cerr << "Can't read input file " << std::endl; + return EXIT_FAILURE; + } if (point_set.has_normal_map()) + { + // Normalization + inversion of normal vectors + for (Point_set::iterator it = point_set.begin(); it != point_set.end(); ++ it) { - // Normalization + inversion of normal vectors - for (Point_set::iterator it = point_set.begin(); it != point_set.end(); ++ it) - { - Vector n = point_set.normal(*it); - n = - n / std::sqrt (n * n); - point_set.normal(*it) = n; - } + Vector n = point_set.normal(*it); + n = - n / std::sqrt (n * n); + point_set.normal(*it) = n; } + } // Writing result in OFF format - std::ofstream out("normalized_normals.off"); - out.precision(17); - if (!out || !CGAL::write_OFF (out, point_set)) - { - return EXIT_FAILURE; - } + if(!CGAL::write_OFF("normalized_normals.off", point_set, CGAL::parameters::stream_precision(17))) + return EXIT_FAILURE; return EXIT_SUCCESS; } diff --git a/Point_set_3/test/Point_set_3/point_set_test_join.cpp b/Point_set_3/test/Point_set_3/point_set_test_join.cpp index b45098b8d2f..c1650f1a0d2 100644 --- a/Point_set_3/test/Point_set_3/point_set_test_join.cpp +++ b/Point_set_3/test/Point_set_3/point_set_test_join.cpp @@ -32,8 +32,7 @@ void print_point_set (const Point_set& ps, const char* msg) { Point_set::Property_map intensity; bool has_intensity; - boost::tie (intensity, has_intensity) - = ps.property_map("intensity"); + boost::tie (intensity, has_intensity) = ps.property_map("intensity"); std::cerr << msg << std::endl; for (Point_set::const_iterator it = ps.begin(); it != ps.end(); ++ it) @@ -47,7 +46,6 @@ void print_point_set (const Point_set& ps, const char* msg) } } - int main (int, char**) { Point_set ps1, ps2; diff --git a/Point_set_processing_3/doc/Point_set_processing_3/Point_set_processing_3.txt b/Point_set_processing_3/doc/Point_set_processing_3/Point_set_processing_3.txt index 6a46d5be3b2..61d4c3891f9 100644 --- a/Point_set_processing_3/doc/Point_set_processing_3/Point_set_processing_3.txt +++ b/Point_set_processing_3/doc/Point_set_processing_3/Point_set_processing_3.txt @@ -210,13 +210,13 @@ descriptor - a tuple consisting of a property map, a functor to construct the objects wanted and multiple %PLY/%LAS property descriptors -Output functions `write_ply_points_with_properties()` and -`write_las_points_with_properties()` work similarly. +Output functions `write_PLY_with_properties()` and +`write_LAS_with_properties()` work similarly. \subsubsection Point_set_processing_3Example_ply_write PLY Writing Example The following example shows how to call -`write_ply_points_with_properties()` to write a point set with points, +`write_PLY_with_properties()` to write a point set with points, RGB colors and intensity. Notice that in order to write a complex object, users need to provide an overload of `CGAL::Output_rep`. 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 a72a8d10c6a..3a4df48d0cf 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 @@ -20,41 +20,41 @@ typedef CGAL::Parallel_if_available_tag Concurrency_tag; int main(int argc, char*argv[]) { - const char* fname = (argc>1)?argv[1]:"data/sphere_20k.xyz"; - // Reads a .xyz point set file in points. - // As the point is the second element of the tuple (that is with index 1) - // we use a property map that accesses the 1st element of the tuple. + const char* fname = (argc>1)?argv[1]:"data/sphere_20k.xyz"; - std::vector 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; - return EXIT_FAILURE; - } + // Reads a .xyz point set file in points. + // As the point is the second element of the tuple (that is with index 1) + // we use a property map that accesses the 1st element of the tuple. - // Initialize index and RGB color fields in tuple. - // As the index and RGB color are respectively the first and third-fifth elements - // of the tuple we use a get function from the property map that accesses the 0 - // and 2-4th elements of the tuple. - for(unsigned int i = 0; i < points.size(); i++) - { - points[i].get<0>() = i; // set index value of tuple to i + std::vector 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; + return EXIT_FAILURE; + } - points[i].get<2>() = 0; // set RGB color to black - points[i].get<3>() = 0; - points[i].get<4>() = 0; - } + // Initialize index and RGB color fields in tuple. + // As the index and RGB color are respectively the first and third-fifth elements + // of the tuple we use a get function from the property map that accesses the 0 + // and 2-4th elements of the tuple. + for(unsigned int i = 0; i < points.size(); i++) + { + points[i].get<0>() = i; // set index value of tuple to i - // Computes average spacing. - const unsigned int nb_neighbors = 6; // 1 ring - FT average_spacing = CGAL::compute_average_spacing( - points, nb_neighbors, - CGAL::parameters::point_map(CGAL::Nth_of_tuple_property_map<1,IndexedPointWithColorTuple>())); + points[i].get<2>() = 0; // set RGB color to black + points[i].get<3>() = 0; + points[i].get<4>() = 0; + } - std::cout << "Average spacing: " << average_spacing << std::endl; + // Computes average spacing. + const unsigned int nb_neighbors = 6; // 1 ring + FT average_spacing = CGAL::compute_average_spacing( + points, nb_neighbors, + CGAL::parameters::point_map(CGAL::Nth_of_tuple_property_map<1,IndexedPointWithColorTuple>())); - return EXIT_SUCCESS; + std::cout << "Average spacing: " << average_spacing << std::endl; + + return EXIT_SUCCESS; } 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 8ce0079d9e3..91f3464af72 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 @@ -22,14 +22,14 @@ typedef CGAL::Parallel_if_available_tag Concurrency_tag; int main(int argc, char*argv[]) { - const char* input_filename = (argc>1)?argv[1]:"data/fin90_with_PCA_normals.xyz"; - const char* output_filename = (argc>2)?argv[2]:"data/fin90_with_PCA_normals_bilateral_smoothed.xyz"; + const char* input_filename = (argc>1) ? argv[1] : "data/fin90_with_PCA_normals.xyz"; + const char* output_filename = (argc>2) ? argv[2] : "data/fin90_with_PCA_normals_bilateral_smoothed.xyz"; // Reads a .xyz point set file in points[] * with normals *. std::vector 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()))) + 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()))) { std::cerr << "Error: cannot read file " << input_filename << std::endl; return EXIT_FAILURE; @@ -42,26 +42,23 @@ int main(int argc, char*argv[]) // The bigger the smoother the result will be int iter_number = 3; // number of times the projection is applied - for (int i = 0; i < iter_number; ++i) + for(int i = 0; i < iter_number; ++i) { /* double error = */ CGAL::bilateral_smooth_point_set ( points, k, - CGAL::parameters::point_map(CGAL::First_of_pair_property_map()). - normal_map(CGAL::Second_of_pair_property_map()). - sharpness_angle (sharpness_angle)); + CGAL::parameters::point_map(CGAL::First_of_pair_property_map()) + .normal_map(CGAL::Second_of_pair_property_map()) + .sharpness_angle (sharpness_angle)); } //// Save point set. - std::ofstream out(output_filename); - out.precision(17); - if (!out || !CGAL::write_XYZ(out, points, - CGAL::parameters::point_map(CGAL::First_of_pair_property_map()) - .normal_map(CGAL::Second_of_pair_property_map()))) - { + if(!CGAL::write_XYZ(output_filename, points, + CGAL::parameters::point_map(CGAL::First_of_pair_property_map()) + .normal_map(CGAL::Second_of_pair_property_map()) + .stream_precision(17))) return EXIT_FAILURE; - } return EXIT_SUCCESS; } diff --git a/Point_set_processing_3/examples/Point_set_processing_3/callback_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/callback_example.cpp index aee58b48726..65bcf6bff78 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/callback_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/callback_example.cpp @@ -60,35 +60,29 @@ struct Progress_to_std_cerr_callback } }; - int main (int argc, char* argv[]) { int N = (argc > 1) ? boost::lexical_cast(argv[1]) : 1000; // Generate N points on a sphere of radius 100. std::vector points; - points.reserve (N); + points.reserve(N); Generator generator(100.); - std::copy_n (generator, N, std::back_inserter(points)); + std::copy_n(generator, N, std::back_inserter(points)); // Compute average spacing FT average_spacing = CGAL::compute_average_spacing (points, 6, - CGAL::parameters::callback - (Progress_to_std_cerr_callback("Computing average spacing"))); + CGAL::parameters::callback(Progress_to_std_cerr_callback("Computing average spacing"))); // Simplify on a grid with a size of twice the average spacing - points.erase(CGAL::grid_simplify_point_set - (points, 2. * average_spacing, - CGAL::parameters::callback - (Progress_to_std_cerr_callback("Grid simplification"))), + points.erase(CGAL::grid_simplify_point_set(points, 2. * average_spacing, + CGAL::parameters::callback(Progress_to_std_cerr_callback("Grid simplification"))), points.end()); // Smooth simplified point set - CGAL::jet_smooth_point_set - (points, 6, - CGAL::parameters::callback - (Progress_to_std_cerr_callback("Jet smoothing"))); + CGAL::jet_smooth_point_set(points, 6, + CGAL::parameters::callback(Progress_to_std_cerr_callback("Jet smoothing"))); return EXIT_SUCCESS; } diff --git a/Point_set_processing_3/examples/Point_set_processing_3/clustering_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/clustering_example.cpp index 934609dd152..eddf432eddf 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/clustering_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/clustering_example.cpp @@ -8,6 +8,7 @@ #include #include +#include using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel; using Point_3 = Kernel::Point_3; @@ -16,12 +17,12 @@ using Point_set = CGAL::Point_set_3; int main (int argc, char** argv) { // Read input file - std::ifstream ifile ((argc > 1) ? argv[1] : "data/hippo1.ply", std::ios_base::binary); + std::ifstream ifile((argc > 1) ? argv[1] : "data/hippo1.ply", std::ios_base::binary); Point_set points; ifile >> points; // Add a cluster map - Point_set::Property_map cluster_map = points.add_property_map ("cluster", -1).first; + Point_set::Property_map cluster_map = points.add_property_map("cluster", -1).first; // Compute average spacing double spacing = CGAL::compute_average_spacing (points, 12); @@ -34,9 +35,9 @@ int main (int argc, char** argv) CGAL::Real_timer t; t.start(); std::size_t nb_clusters - = CGAL::cluster_point_set (points, cluster_map, - points.parameters().neighbor_radius(spacing). - adjacencies (std::back_inserter (adjacencies))); + = CGAL::cluster_point_set(points, cluster_map, + points.parameters().neighbor_radius(spacing) + .adjacencies(std::back_inserter(adjacencies))); t.stop(); std::cerr << "Found " << nb_clusters << " clusters with " << adjacencies.size() << " adjacencies in " << t.time() << " seconds" << std::endl; @@ -45,7 +46,7 @@ int main (int argc, char** argv) Point_set::Property_map red = points.add_property_map("red", 0).first; Point_set::Property_map green = points.add_property_map("green", 0).first; Point_set::Property_map blue = points.add_property_map("blue", 0).first; - for (Point_set::Index idx : points) + for(Point_set::Index idx : points) { // One color per cluster CGAL::Random rand (cluster_map[idx]); @@ -54,8 +55,8 @@ int main (int argc, char** argv) blue[idx] = rand.get_int(64, 192); } - std::ofstream ofile ("out.ply", std::ios_base::binary); - CGAL::set_binary_mode (ofile); + std::ofstream ofile("out.ply", std::ios_base::binary); + CGAL::set_binary_mode(ofile); ofile << points; return EXIT_SUCCESS; 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 9ebee879767..2456b2dc1bc 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 @@ -20,15 +20,15 @@ typedef CGAL::Parallel_if_available_tag Concurrency_tag; int main(int argc, char* argv[]) { - const char* input_filename = (argc>1)?argv[1]:"data/before_upsample.xyz"; - const char* output_filename = (argc>2)?argv[2]:"data/before_upsample_UPSAMPLED.xyz"; + const char* input_filename = (argc>1) ? argv[1] : "data/before_upsample.xyz"; + const char* output_filename = (argc>2) ? argv[2] : "data/before_upsample_UPSAMPLED.xyz"; // Reads a .xyz point set file in points[], *with normals*. std::vector 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()))) + 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()))) { std::cerr << "Error: cannot read file " << input_filename << std::endl; return EXIT_FAILURE; @@ -52,14 +52,11 @@ int main(int argc, char* argv[]) number_of_output_points(number_of_output_points)); // Saves point set. - std::ofstream out(output_filename); - out.precision(17); - if (!out || !CGAL::write_XYZ(out, points, - CGAL::parameters::point_map(CGAL::First_of_pair_property_map()) - .normal_map(CGAL::Second_of_pair_property_map()))) - { + if(!CGAL::write_points(output_filename, points, + CGAL::parameters::point_map(CGAL::First_of_pair_property_map()) + .normal_map(CGAL::Second_of_pair_property_map()) + .stream_precision(17))) return EXIT_FAILURE; - } return EXIT_SUCCESS; } 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 8b7ae295287..394144a2041 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 @@ -7,7 +7,6 @@ #include #include - // Types typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; typedef Kernel::Point_3 Point; @@ -19,38 +18,39 @@ typedef std::vector PointList; typedef std::array Covariance; -int main (int , char**) { - // Reads a .xyz point set file in points[]. - std::list points; - if (!CGAL::read_points("data/fandisk.off", +int main (int , char**) +{ + // Reads a .xyz point set file in points[]. + std::list points; + if(!CGAL::read_points("data/fandisk.off", std::back_inserter(points), CGAL::parameters::point_map(CGAL::First_of_pair_property_map()))) - { - std::cerr << "Error: cannot read file data/fandisk.off" << std::endl; - return EXIT_FAILURE; - } + { + std::cerr << "Error: cannot read file data/fandisk.off" << std::endl; + return EXIT_FAILURE; + } - // Estimates covariance matrices per points. - double R = 0.2, - r = 0.1; - std::vector cov; - CGAL::First_of_pair_property_map point_map; + // Estimates covariance matrices per points. + double R = 0.2, + r = 0.1; + std::vector cov; + CGAL::First_of_pair_property_map point_map; - CGAL::compute_vcm(points, cov, R, r, - CGAL::parameters::point_map (point_map).geom_traits (Kernel())); + CGAL::compute_vcm(points, cov, R, r, + CGAL::parameters::point_map (point_map).geom_traits (Kernel())); - // Find the points on the edges. - // Note that this step is not expensive and can be done several time to get better results - double threshold = 0.16; - std::ofstream output("points_on_edges.xyz"); - int i = 0; - for(const PointVectorPair& p : points) - { - if (CGAL::vcm_is_on_feature_edge(cov[i], threshold)) - output << p.first << "\n"; - ++i; - } + // Find the points on the edges. + // Note that this step is not expensive and can be done several time to get better results + double threshold = 0.16; + std::ofstream output("points_on_edges.xyz"); + int i = 0; + for(const PointVectorPair& p : points) + { + if(CGAL::vcm_is_on_feature_edge(cov[i], threshold)) + output << p.first << "\n"; + ++i; + } - return 0; + return 0; } 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 b2f27d6b6a3..081175cf681 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,4 +1,5 @@ #include + #include #include @@ -13,8 +14,8 @@ 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"; - if (!CGAL::read_points(fname, std::back_inserter(points))) + const char* fname = (argc>1) ? argv[1] : "data/oni.xyz"; + if(!CGAL::read_points(fname, std::back_inserter(points))) { std::cerr << "Error: cannot read file " << fname << std::endl; return EXIT_FAILURE; @@ -22,12 +23,10 @@ int main(int argc, char*argv[]) // simplification by clustering using erase-remove idiom double cell_size = 0.001; - points.erase(CGAL::grid_simplify_point_set(points, cell_size), - points.end()); + points.erase(CGAL::grid_simplify_point_set(points, cell_size), points.end()); // Optional: after erase(), use Scott Meyer's "swap trick" to trim excess capacity std::vector(points).swap(points); return EXIT_SUCCESS; } - diff --git a/Point_set_processing_3/examples/Point_set_processing_3/grid_simplify_indices.cpp b/Point_set_processing_3/examples/Point_set_processing_3/grid_simplify_indices.cpp index 85581dd060a..7355e5be182 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/grid_simplify_indices.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/grid_simplify_indices.cpp @@ -1,4 +1,5 @@ #include + #include #include @@ -15,11 +16,12 @@ int main(int argc, char*argv[]) // Reads a .xyz point set file in points[]. std::vector points; std::vector normals; - const char* fname = (argc>1)?argv[1]:"data/fin90_with_PCA_normals.xyz"; + const char* fname = (argc>1) ? argv[1] : "data/fin90_with_PCA_normals.xyz"; std::ifstream stream(fname); Point p; Vector v; - while(stream >> p >> v){ + while(stream >> p >> v) + { points.push_back(p); normals.push_back(v); } 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 a751668be0b..ebec64008a5 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 @@ -15,23 +15,24 @@ typedef Kernel::Point_3 Point; int main(int argc, char*argv[]) { - // Reads a .xyz point set file in points[]. + // Reads a point set file in points[]. std::vector points; const char* fname = (argc>1)?argv[1]:"data/oni.xyz"; - if (!CGAL::read_points(fname, 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; } + std::cout << "Read " << points.size () << " point(s)" << std::endl; CGAL::Timer task_timer; task_timer.start(); // simplification by clustering using erase-remove idiom - points.erase (CGAL::hierarchy_simplify_point_set (points, - CGAL::parameters::size(100). // Max cluster size - maximum_variation(0.01)), // Max surface variation - points.end ()); + points.erase(CGAL::hierarchy_simplify_point_set(points, + CGAL::parameters::size(100)// Max cluster size + .maximum_variation(0.01)), // Max surface variation + points.end()); std::size_t memory = CGAL::Memory_sizer().virtual_size(); @@ -39,9 +40,7 @@ int main(int argc, char*argv[]) << task_timer.time() << " seconds, " << (memory>>20) << " Mib allocated." << std::endl; - std::ofstream f ("out.xyz"); - f.precision(17); - CGAL::write_XYZ (f, points); + CGAL::write_points("out.xyz", points, CGAL::parameters::stream_precision(17)); return EXIT_SUCCESS; } diff --git a/Point_set_processing_3/examples/Point_set_processing_3/jet_smoothing_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/jet_smoothing_example.cpp index 85be76af70d..d28abdc5100 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/jet_smoothing_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/jet_smoothing_example.cpp @@ -30,4 +30,3 @@ int main(void) return EXIT_SUCCESS; } - 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 52980c2cfe7..9e96b034864 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 @@ -9,19 +9,19 @@ //---------------------------------------------------------- // normal_estimation file_in file_out [options] -// CGAL -#include -#include -#include - // This package +#include +#include #include #include #include #include #include -#include -#include + +// CGAL +#include +#include +#include #include // defines std::pair #include @@ -29,7 +29,6 @@ #include #include - // ---------------------------------------------------------------------------- // Types // ---------------------------------------------------------------------------- @@ -69,7 +68,6 @@ void run_pca_estimate_normals(PointList& points, // input points + output normal CGAL::parameters::point_map (CGAL::First_of_pair_property_map()). normal_map (CGAL::Second_of_pair_property_map())); - std::size_t memory = CGAL::Memory_sizer().virtual_size(); std::cerr << "done: " << task_timer.time() << " seconds, " << (memory>>20) << " Mb allocated" @@ -247,21 +245,8 @@ int main(int argc, char * argv[]) std::cerr << "Open " << input_filename << " for reading..." << std::endl; // If OFF file format - bool success = false; - std::string extension = input_filename.substr(input_filename.find_last_of('.')); - if (extension == ".off" || extension == ".OFF") - { - success = CGAL::read_points(input_filename.c_str(), std::back_inserter(points), - CGAL::parameters::point_map(CGAL::First_of_pair_property_map())); - } - // If XYZ file format - else if (extension == ".xyz" || extension == ".XYZ" || - extension == ".pwn" || extension == ".PWN") - { - success = CGAL::read_points(input_filename.c_str(), std::back_inserter(points), - CGAL::parameters::point_map(CGAL::First_of_pair_property_map())); - } - if (!success) + if(!CGAL::read_points(input_filename.c_str(), std::back_inserter(points), + CGAL::parameters::point_map(CGAL::First_of_pair_property_map()))) { std::cerr << "Error: cannot read file " << input_filename << std::endl; return EXIT_FAILURE; @@ -278,7 +263,7 @@ int main(int argc, char * argv[]) // Check requirements //*************************************** - if (nb_points == 0) + if(nb_points == 0) { std::cerr << "Error: empty file" << std::endl; return EXIT_FAILURE; @@ -306,25 +291,13 @@ int main(int argc, char * argv[]) std::cerr << "Write file " << output_filename << std::endl << std::endl; - // If XYZ file format - /*std::string*/ extension = output_filename.substr(output_filename.find_last_of('.')); - if (extension == ".xyz" || extension == ".XYZ" || - extension == ".pwn" || extension == ".PWN") + if(!CGAL::write_points(output_filename, points, + CGAL::parameters::point_map(CGAL::First_of_pair_property_map()) + .normal_map(CGAL::Second_of_pair_property_map()) + .stream_precision(17))) { - std::ofstream stream(output_filename.c_str()); - stream.precision(17); - if (!stream || !CGAL::write_XYZ(stream, points, - CGAL::parameters::point_map(CGAL::First_of_pair_property_map()) - .normal_map(CGAL::Second_of_pair_property_map()))) - { - std::cerr << "Error: cannot write file " << output_filename << std::endl; - return EXIT_FAILURE; - } - } - else - { - std::cerr << "Error: cannot write file " << output_filename << std::endl; - return EXIT_FAILURE; + std::cerr << "Error: cannot write file " << output_filename << std::endl; + return EXIT_FAILURE; } // Returns accumulated fatal error 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 0fdacc3cd10..1317d915b36 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 @@ -1,4 +1,5 @@ #include + #include #include #include @@ -22,58 +23,58 @@ typedef CGAL::Parallel_if_available_tag Concurrency_tag; 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; - if (!CGAL::read_points(fname, + const char* fname = (argc>1) ? argv[1] : "data/sphere_1k.xyz"; + + // Reads a .xyz point set file in points[]. + std::list points; + if(!CGAL::read_points(fname, std::back_inserter(points), CGAL::parameters::point_map(CGAL::First_of_pair_property_map()))) - { - std::cerr << "Error: cannot read file " << fname<< std::endl; - return EXIT_FAILURE; - } + { + std::cerr << "Error: cannot read file " << fname<< std::endl; + return EXIT_FAILURE; + } - // Estimates normals direction. - // Note: pca_estimate_normals() requiresa range of points - // as well as property maps to access each point's position and normal. - const int nb_neighbors = 18; // K-nearest neighbors = 3 rings + // Estimates normals direction. + // Note: pca_estimate_normals() requiresa range of points + // as well as property maps to access each point's position and normal. + const int nb_neighbors = 18; // K-nearest neighbors = 3 rings - if (argc > 2 && std::strcmp(argv[2], "-r") == 0) // Use a fixed neighborhood radius - { - // First compute a spacing using the K parameter - double spacing + if (argc > 2 && std::strcmp(argv[2], "-r") == 0) // Use a fixed neighborhood radius + { + // First compute a spacing using the K parameter + double spacing = CGAL::compute_average_spacing - (points, nb_neighbors, - CGAL::parameters::point_map(CGAL::First_of_pair_property_map())); + (points, nb_neighbors, + CGAL::parameters::point_map(CGAL::First_of_pair_property_map())); - // Then, estimate normals with a fixed radius - CGAL::pca_estimate_normals + // Then, estimate normals with a fixed radius + CGAL::pca_estimate_normals (points, 0, // when using a neighborhood radius, K=0 means no limit on the number of neighbors returns - CGAL::parameters::point_map(CGAL::First_of_pair_property_map()). - normal_map(CGAL::Second_of_pair_property_map()). - neighbor_radius(2. * spacing)); // use 2*spacing as neighborhood radius - } - else // Use a fixed number of neighbors - { - CGAL::pca_estimate_normals + CGAL::parameters::point_map(CGAL::First_of_pair_property_map()) + .normal_map(CGAL::Second_of_pair_property_map()) + .neighbor_radius(2. * spacing)); // use 2*spacing as neighborhood radius + } + else // Use a fixed number of neighbors + { + CGAL::pca_estimate_normals (points, nb_neighbors, - CGAL::parameters::point_map(CGAL::First_of_pair_property_map()). - normal_map(CGAL::Second_of_pair_property_map())); - } + CGAL::parameters::point_map(CGAL::First_of_pair_property_map()) + .normal_map(CGAL::Second_of_pair_property_map())); + } - // Orients normals. - // Note: mst_orient_normals() requires a range of points - // as well as property maps to access each point's position and normal. - std::list::iterator unoriented_points_begin = + // Orients normals. + // Note: mst_orient_normals() requires a range of points + // as well as property maps to access each point's position and normal. + std::list::iterator unoriented_points_begin = CGAL::mst_orient_normals(points, nb_neighbors, - CGAL::parameters::point_map(CGAL::First_of_pair_property_map()). - normal_map(CGAL::Second_of_pair_property_map())); + CGAL::parameters::point_map(CGAL::First_of_pair_property_map()) + .normal_map(CGAL::Second_of_pair_property_map())); - // Optional: delete points with an unoriented normal - // if you plan to call a reconstruction algorithm that expects oriented normals. - points.erase(unoriented_points_begin, points.end()); + // Optional: delete points with an unoriented normal + // if you plan to call a reconstruction algorithm that expects oriented normals. + points.erase(unoriented_points_begin, points.end()); - return EXIT_SUCCESS; + return EXIT_SUCCESS; } - diff --git a/Point_set_processing_3/examples/Point_set_processing_3/property_map.cpp b/Point_set_processing_3/examples/Point_set_processing_3/property_map.cpp index 2dadc614d61..56a131c35e3 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/property_map.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/property_map.cpp @@ -43,7 +43,6 @@ struct MyLess { } }; - // In this example we have a function that only operates on the point part. // It sorts them lexicographically. @@ -54,7 +53,6 @@ void process_point_set(Iterator beg, Iterator end, PointPMap pmap) std::sort(beg,end,less); } - // We can call it just with points. Then interally we use a property map // that maps point iterators on points. @@ -67,8 +65,6 @@ void process_point_set(Iterator beg, Iterator end) ); } - - // Here comes a function that changes the orientation and the normal template @@ -84,8 +80,6 @@ void orient_normals(Iterator beg, Iterator end, OrientationPMap orient_pmap, Nor } } - - int main() { CGAL::set_pretty_mode(std::cout); @@ -93,30 +87,23 @@ int main() // Here we run it on plain points. No need for a property map { std::vector points; - process_point_set(points.begin(), points.end()); } - // Here we run it on points with normal vectors stored in a std::pair. // We use a property map that accesses pair::first. { std::vector points; - for(int i = 0; i < 10; i++){ + for(int i = 0; i < 10; i++) points.push_back(std::make_pair(Point_3(9-i,0,0), Vector_3(i,0,0))); - } - process_point_set(points.begin(), - points.end(), - CGAL::First_of_pair_property_map()); + process_point_set(points.begin(), points.end(), CGAL::First_of_pair_property_map()); - for(int i = 0; i < 10; i++){ + for(int i = 0; i < 10; i++) std::cout << points[i].first << "\t" << points[i].second << std::endl; - } } - // Here we run it on tuples. To see the interest I made up my own // data type = index, followed by the point, followed by a Boolean // that tells us whether the normal is oriented or not, followed by the normal vector. @@ -128,31 +115,27 @@ int main() typedef boost::tuple IndexedPointWithOrientableNormalTuple; std::vector points; - for(int i = 0; i < 10; i++){ + for(int i = 0; i < 10; i++) + { double x = (i%2)?i:-i; points.push_back(boost::make_tuple(i,Point_3(9-i,0,0), false, Vector_3(x,0,0))); } - process_point_set(points.begin(), - points.end(), - CGAL::Nth_of_tuple_property_map<1,IndexedPointWithOrientableNormalTuple>()); + process_point_set(points.begin(), points.end(), CGAL::Nth_of_tuple_property_map<1,IndexedPointWithOrientableNormalTuple>()); std::cout << boost::tuples::set_open('[') << boost::tuples::set_close(']') << boost::tuples::set_delimiter(','); - for(int i = 0; i < 10; i++){ - std::cout << points[i] << std::endl; - } + for(int i = 0; i < 10; i++) + std::cout << points[i] << std::endl; //We keep the sequence in order, but determine the normal and if it is different from zero set the Boolean to true - orient_normals(points.begin(), - points.end(), + orient_normals(points.begin(), points.end(), CGAL::make_nth_of_tuple_property_map<2>(IndexedPointWithOrientableNormalTuple()), CGAL::make_nth_of_tuple_property_map<3>(IndexedPointWithOrientableNormalTuple())); std::cout << "\nAfter orient_normals\n"; - for(int i = 0; i < 10; i++){ - std::cout << points[i] << std::endl; - } + for(int i = 0; i < 10; i++) + std::cout << points[i] << std::endl; } // same test with std::tuple @@ -160,17 +143,16 @@ int main() typedef std::tuple IndexedPointWithOrientableNormalTuple; std::vector points; - for(int i = 0; i < 10; i++){ + for(int i = 0; i < 10; i++) + { double x = (i%2)?i:-i; points.push_back(std::make_tuple(i,Point_3(9-i,0,0), false, Vector_3(x,0,0))); } - process_point_set(points.begin(), - points.end(), + process_point_set(points.begin(), points.end(), CGAL::Nth_of_tuple_property_map<1,IndexedPointWithOrientableNormalTuple>()); - orient_normals(points.begin(), - points.end(), + orient_normals(points.begin(), points.end(), CGAL::make_nth_of_tuple_property_map<2>(IndexedPointWithOrientableNormalTuple()), CGAL::make_nth_of_tuple_property_map<3>(IndexedPointWithOrientableNormalTuple())); } 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 72af7fa0f80..d6ec4e2904a 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,7 +1,8 @@ #include + #include #include -#include +#include #include #include @@ -13,10 +14,11 @@ typedef Kernel::Point_3 Point; int main(int argc, char*argv[]) { - const char* fname = (argc>1)?argv[1]:"data/oni.xyz"; - // Reads a .xyz point set file in points[]. + const char* fname = (argc>1) ? argv[1] : "data/oni.xyz"; + + // Reads a point set file in points[]. std::vector points; - if (!CGAL::read_points(fname, 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; @@ -24,22 +26,15 @@ int main(int argc, char*argv[]) // Randomly simplifies using erase-remove idiom const double removed_percentage = 97.0; // percentage of points to remove - points.erase(CGAL::random_simplify_point_set(points, removed_percentage), - points.end()); + points.erase(CGAL::random_simplify_point_set(points, removed_percentage), points.end()); // Optional: after erase(), use Scott Meyer's "swap trick" to trim excess capacity std::vector(points).swap(points); // Saves point set. - std::ofstream out((argc>2)?argv[2]:"Three_lady_copy.xyz"); - out.precision(17); - if (!out || - !CGAL::write_XYZ( - out, points)) - { - return EXIT_FAILURE; - } + const std::string output_filename = (argc>2) ? argv[2] : "Three_lady_copy.xyz"; + if(!CGAL::write_points(output_filename, points, CGAL::parameters::stream_precision(17))) + return EXIT_FAILURE; return EXIT_SUCCESS; } - diff --git a/Point_set_processing_3/examples/Point_set_processing_3/read_las_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/read_las_example.cpp index 23bb19016cd..15955da3756 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/read_las_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/read_las_example.cpp @@ -1,6 +1,7 @@ #include + #include -#include +#include #include #include @@ -21,24 +22,20 @@ int main(int argc, char*argv[]) std::vector points; // store points std::ifstream in(fname, std::ios_base::binary); - if (!in || - !CGAL::read_LAS_with_properties - (in, - std::back_inserter (points), - CGAL::make_las_point_reader (CGAL::First_of_pair_property_map()), - std::make_tuple - (CGAL::Second_of_pair_property_map(), - CGAL::Construct_array(), - CGAL::LAS_property::R(), - CGAL::LAS_property::G(), - CGAL::LAS_property::B(), - CGAL::LAS_property::I()))) - { - std::cerr << "Error: cannot read file " << fname << std::endl; - return EXIT_FAILURE; - } + if(!CGAL::read_LAS_with_properties(in, std::back_inserter (points), + CGAL::make_las_point_reader(CGAL::First_of_pair_property_map()), + std::make_tuple(CGAL::Second_of_pair_property_map(), + CGAL::Construct_array(), + CGAL::LAS_property::R(), + CGAL::LAS_property::G(), + CGAL::LAS_property::B(), + CGAL::LAS_property::I()))) + { + std::cerr << "Error: cannot read file " << fname << std::endl; + return EXIT_FAILURE; + } - for (std::size_t i = 0; i < points.size(); ++ i) + for(std::size_t i = 0; i < points.size(); ++ i) std::cout << points[i].first << std::endl; return EXIT_SUCCESS; diff --git a/Point_set_processing_3/examples/Point_set_processing_3/read_ply_points_with_colors_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/read_ply_points_with_colors_example.cpp index 212b54ceb62..347ac0aecf4 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/read_ply_points_with_colors_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/read_ply_points_with_colors_example.cpp @@ -1,6 +1,7 @@ #include + #include -#include +#include #include #include @@ -23,41 +24,36 @@ typedef CGAL::Nth_of_tuple_property_map<3, PNCI> Intensity_map; int main(int argc, char*argv[]) { const char* fname = (argc>1) ? argv[1] : "data/colors.ply"; - // Reads a .ply point set file with normal vectors and colors + // Reads a .ply point set file with normal vectors and colors std::vector points; // store points std::ifstream in(fname); - - if (!in || - !CGAL::read_PLY_with_properties - (in, - std::back_inserter (points), - CGAL::make_ply_point_reader (Point_map()), - std::make_pair (Intensity_map(), - CGAL::PLY_property("intensity")), - std::make_tuple (Color_map(), - CGAL::Construct_array(), - CGAL::PLY_property("red"), - CGAL::PLY_property("green"), - CGAL::PLY_property("blue")), - CGAL::make_ply_normal_reader (Normal_map()) - )) - { - std::cerr << "Error: cannot read file " << fname << std::endl; - return EXIT_FAILURE; - } + if(!CGAL::read_PLY_with_properties(in, std::back_inserter(points), + CGAL::make_ply_point_reader(Point_map()), + std::make_pair(Intensity_map(), CGAL::PLY_property("intensity")), + std::make_tuple(Color_map(), + CGAL::Construct_array(), + CGAL::PLY_property("red"), + CGAL::PLY_property("green"), + CGAL::PLY_property("blue")), + CGAL::make_ply_normal_reader(Normal_map()))) + { + std::cerr << "Error: cannot read file " << fname << std::endl; + return EXIT_FAILURE; + } // Display points read - for (std::size_t i = 0; i < points.size (); ++ i) - { - const Point& p = get<0>(points[i]); - const Vector& n = get<1>(points[i]); - const Color& c = get<2>(points[i]); - int I = get<3>(points[i]); - std::cerr << "Point (" << p << ") with normal (" << n - << "), color (" << int(c[0]) << " " << int(c[1]) << " " << int(c[2]) - << ") and intensity " << I << std::endl; - } + for(std::size_t i = 0; i < points.size (); ++ i) + { + const Point& p = get<0>(points[i]); + const Vector& n = get<1>(points[i]); + const Color& c = get<2>(points[i]); + int I = get<3>(points[i]); + std::cerr << "Point (" << p + << ") with normal (" << n + << "), color (" << int(c[0]) << " " << int(c[1]) << " " << int(c[2]) + << ") and intensity " << I << std::endl; + } return EXIT_SUCCESS; } 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 119fcdc12a0..c1bfc88bf71 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 @@ -24,10 +24,10 @@ int main(int argc, char*argv[]) // over points and as well as property maps to access each // point position and normal. std::vector points; - 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()))) + if(!CGAL::read_XYZ(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; @@ -36,16 +36,11 @@ int main(int argc, char*argv[]) // Saves point set. // Note: write_XYZ() requires property maps to access each // point position and normal. - std::ofstream out("oni_copy.xyz"); - out.precision(17); - if (!out || - !CGAL::write_XYZ( - out, points, - CGAL::parameters::point_map(CGAL::First_of_pair_property_map()). - normal_map(CGAL::Second_of_pair_property_map()))) - { + if(!CGAL::write_XYZ("oni_copy.xyz", points, + CGAL::parameters::point_map(CGAL::First_of_pair_property_map()) + .normal_map(CGAL::Second_of_pair_property_map()) + .stream_precision(17))) return EXIT_FAILURE; - } return EXIT_SUCCESS; } 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 3249d2058dd..99dbe1e5a82 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 @@ -21,21 +21,21 @@ namespace params = CGAL::parameters; int main(int argc, const char** argv) { - const char* fname1 = (argc>1)?argv[1]:"data/hippo1.ply"; - const char* fname2 = (argc>2)?argv[2]:"data/hippo2.ply"; + const char* fname1 = (argc>1) ? argv[1] : "data/hippo1.ply"; + const char* fname2 = (argc>2) ? argv[2] : "data/hippo2.ply"; std::vector pwns1, pwns2; - if (!CGAL::read_points(fname1, 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; } - if (!CGAL::read_points(fname2, 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; @@ -45,33 +45,29 @@ int main(int argc, const char** argv) // std::pair res = CGAL::OpenGR::compute_registration_transformation(pwns1, pwns2, params::point_map(Point_map()) - .normal_map(Normal_map()) - .number_of_samples(200) - .maximum_running_time(60) - .accuracy(0.01), + .normal_map(Normal_map()) + .number_of_samples(200) + .maximum_running_time(60) + .accuracy(0.01), params::point_map(Point_map()) - .normal_map(Normal_map())); + .normal_map(Normal_map())); // OR call the registration method Super4PCS from OpenGR and apply the transformation to pwn2 double score = CGAL::OpenGR::register_point_sets(pwns1, pwns2, params::point_map(Point_map()) - .normal_map(Normal_map()) - .number_of_samples(200) - .maximum_running_time(60) - .accuracy(0.01), + .normal_map(Normal_map()) + .number_of_samples(200) + .maximum_running_time(60) + .accuracy(0.01), params::point_map(Point_map()) - .normal_map(Normal_map())); + .normal_map(Normal_map())); - std::ofstream out("pwns2_aligned.ply"); - if (!out || - !CGAL::write_PLY( - out, pwns2, - CGAL::parameters::point_map(Point_map()). - normal_map(Normal_map()))) - { + if(!CGAL::write_points("pwns2_aligned.ply", pwns2, + CGAL::parameters::point_map(Point_map()) + .normal_map(Normal_map()) + .stream_precision(17))) return EXIT_FAILURE; - } std::cout << "Registration score: " << score << ".\n" << "Transformed version of " << fname2 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 d5e42db205f..a26cb3e4dcc 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,6 +1,7 @@ #include + #include -#include +#include #include #include @@ -24,21 +25,21 @@ namespace params = CGAL::parameters; int main(int argc, const char** argv) { - const char* fname1 = (argc>1)?argv[1]:"data/hippo1.ply"; - const char* fname2 = (argc>2)?argv[2]:"data/hippo2.ply"; + const char* fname1 = (argc>1) ? argv[1] : "data/hippo1.ply"; + const char* fname2 = (argc>2) ? argv[2] : "data/hippo2.ply"; std::vector pwns1, pwns2; - if (!CGAL::read_points(fname1, 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; } - if (!CGAL::read_points(fname2, 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; @@ -51,8 +52,7 @@ int main(int argc, const char** argv) CGAL::OpenGR::compute_registration_transformation (pwns1, pwns2, params::point_map(Point_map()).normal_map(Normal_map()), - params::point_map(Point_map()).normal_map(Normal_map())) - ); + params::point_map(Point_map()).normal_map(Normal_map()))); std::cerr << "Computing registration transformation using PointMatcher ICP, " << "taking transformation computed by OpenGR Super4PCS as initial transformation.." << std::endl; @@ -62,15 +62,11 @@ int main(int argc, const char** argv) CGAL::pointmatcher::register_point_sets (pwns1, pwns2, params::point_map(Point_map()).normal_map(Normal_map()), - params::point_map(Point_map()).normal_map(Normal_map()) - .transformation(res)); + params::point_map(Point_map()).normal_map(Normal_map()).transformation(res)); - std::ofstream out("pwns2_aligned.ply"); - if (!out || - !CGAL::write_PLY( - out, pwns2, - CGAL::parameters::point_map(Point_map()). - normal_map(Normal_map()))) + if(!CGAL::write_points("pwns2_aligned.ply", pwns2, + CGAL::parameters::point_map(Point_map()) + .normal_map(Normal_map()))) { return EXIT_FAILURE; } 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 864d421eded..44d904d645c 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 @@ -28,17 +28,17 @@ int main(int argc, const char** argv) const char* fname2 = (argc>2)?argv[2]:"data/hippo2.ply"; std::vector pwns1, pwns2; - if (!CGAL::read_points(fname1, 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; } - if (!CGAL::read_points(fname2, 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; @@ -89,64 +89,59 @@ int main(int argc, const char** argv) // EITHER call the ICP registration method pointmatcher to get the transformation to apply to pwns2 std::pair res = - CGAL::pointmatcher::compute_registration_transformation - (pwns1, pwns2, - params::point_map(Point_map()).normal_map(Normal_map()) - .point_set_filters(point_set_1_filters) - .matcher(matcher) - .outlier_filters(outlier_filters) - .error_minimizer(error_minimizer) - .transformation_checkers(transformation_checkers) - .inspector(inspector) - .logger(logger), - params::point_map(Point_map()).normal_map(Normal_map()) - .point_set_filters(point_set_2_filters) - .transformation(identity_transform) /* initial transform for pwns2. - * default value is already identity transform. - * a proper initial transform could be given, for example, - * a transform returned from a coarse registration algorithm. - * */ - ); + CGAL::pointmatcher::compute_registration_transformation + (pwns1, pwns2, + params::point_map(Point_map()).normal_map(Normal_map()) + .point_set_filters(point_set_1_filters) + .matcher(matcher) + .outlier_filters(outlier_filters) + .error_minimizer(error_minimizer) + .transformation_checkers(transformation_checkers) + .inspector(inspector) + .logger(logger), + params::point_map(Point_map()).normal_map(Normal_map()) + .point_set_filters(point_set_2_filters) + .transformation(identity_transform) /* initial transform for pwns2. + * default value is already identity transform. + * a proper initial transform could be given, for example, + * a transform returned from a coarse registration algorithm. + * */ + ); // OR call the ICP registration method from pointmatcher and apply the transformation to pwn2 bool converged = - CGAL::pointmatcher::register_point_sets - (pwns1, pwns2, - params::point_map(Point_map()).normal_map(Normal_map()) - .point_set_filters(point_set_1_filters) - .matcher(matcher) - .outlier_filters(outlier_filters) - .error_minimizer(error_minimizer) - .transformation_checkers(transformation_checkers) - .inspector(inspector) - .logger(logger), - params::point_map(Point_map()).normal_map(Normal_map()) - .point_set_filters(point_set_2_filters) - .transformation(res.first) /* pass the above computed transformation as initial transformation. - * as a result, the registration will require less iterations to converge. - * */ + CGAL::pointmatcher::register_point_sets + (pwns1, pwns2, + params::point_map(Point_map()).normal_map(Normal_map()) + .point_set_filters(point_set_1_filters) + .matcher(matcher) + .outlier_filters(outlier_filters) + .error_minimizer(error_minimizer) + .transformation_checkers(transformation_checkers) + .inspector(inspector) + .logger(logger), + params::point_map(Point_map()).normal_map(Normal_map()) + .point_set_filters(point_set_2_filters) + .transformation(res.first) /* pass the above computed transformation as initial transformation. + * as a result, the registration will require less iterations to converge. + * */ ); - if (converged) + if(converged) + { std::cerr << "Success" << std::endl; + } else { std::cerr << "Failure" << std::endl; return EXIT_FAILURE; } - std::ofstream out("pwns2_aligned.ply"); - if (!out || - !CGAL::write_PLY( - out, pwns2, - CGAL::parameters::point_map(Point_map()). - normal_map(Normal_map()))) - { + if(!CGAL::write_points("pwns2_aligned.ply", pwns2, + CGAL::parameters::point_map(Point_map()).normal_map(Normal_map()))) return EXIT_FAILURE; - } - std::cout << "Transformed version of " << fname2 - << " written to pwn2_aligned.ply.\n"; + std::cout << "Transformed version of " << fname2 << " written to pwn2_aligned.ply.\n"; return EXIT_SUCCESS; } 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 0c390fb6e7c..777fb38828e 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 @@ -1,4 +1,5 @@ #include + #include #include #include @@ -15,11 +16,12 @@ typedef Kernel::Point_3 Point; int main(int argc, char*argv[]) { const char* fname = (argc>1)?argv[1]:"data/oni.xyz"; - // Reads a .xyz point set file in points[]. + + // Reads a point set file in points[]. // The Identity_property_map property map can be omitted here as it is the default value. std::vector points; - if (!CGAL::read_points(fname, 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; @@ -30,8 +32,7 @@ int main(int argc, char*argv[]) const int nb_neighbors = 24; // considers 24 nearest neighbor points // Estimate scale of the point set with average spacing - const double average_spacing = CGAL::compute_average_spacing - (points, nb_neighbors); + const double average_spacing = CGAL::compute_average_spacing(points, nb_neighbors); ////////////////// // FIRST OPTION // diff --git a/Point_set_processing_3/examples/Point_set_processing_3/scale_estimation_2d_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/scale_estimation_2d_example.cpp index d024169ff25..ab640b14e88 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/scale_estimation_2d_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/scale_estimation_2d_example.cpp @@ -1,4 +1,5 @@ #include + #include #include 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 4d10ad09d02..44ad52df5ae 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,6 +1,6 @@ #include -#include +#include #include #include #include @@ -21,7 +21,6 @@ typedef Kernel::Point_3 Point_3; int main (int argc, char** argv) { - const char* fname = (argc>1)?argv[1]:"data/sphere_20k.xyz"; CGAL::Timer task_timer; @@ -29,11 +28,11 @@ int main (int argc, char** argv) std::vector points; // read input - if (!CGAL::read_points(fname, std::back_inserter(points))) - { - std::cerr << "Error: can't read input file" << std::endl; - return EXIT_FAILURE; - } + if(!CGAL::read_points(fname, std::back_inserter(points))) + { + std::cerr << "Error: can't read input file" << std::endl; + return EXIT_FAILURE; + } // estimate k scale task_timer.start(); @@ -41,8 +40,7 @@ int main (int argc, char** argv) task_timer.stop(); // Example: use estimated k as scale for jet smoothing - CGAL::jet_smooth_point_set - (points, static_cast(k_scale)); + CGAL::jet_smooth_point_set(points, static_cast(k_scale)); // estimate range scale task_timer.start(); @@ -50,9 +48,7 @@ int main (int argc, char** argv) task_timer.stop(); // Example: use estimated range for grid simplification - points.erase (CGAL::grid_simplify_point_set (points, range_scale), - points.end()); - + points.erase(CGAL::grid_simplify_point_set(points, range_scale), points.end()); // print some informations on runtime std::size_t memory = CGAL::Memory_sizer().virtual_size(); @@ -63,7 +59,6 @@ int main (int argc, char** argv) std::cout << " * Global K scale: " << k_scale << std::endl; std::cout << " * Global range scale: " << range_scale << std::endl; - return EXIT_SUCCESS; } 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 eafe6a3ce6b..1e1b6bfc4e3 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,10 +1,9 @@ #include + #include -#include +#include #include - #include - #include #include @@ -32,12 +31,12 @@ int main (int argc, char** argv) // Loading point set from a file. 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()))) + 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; + std::cerr << "Error: cannot read file cube.pwn" << std::endl; + return EXIT_FAILURE; } std::cerr << points.size() << " point(s) read." << std::endl; @@ -52,22 +51,22 @@ int main (int argc, char** argv) Pwn_vector structured_pts; - CGAL::structure_point_set (points, - planes, - std::back_inserter (structured_pts), - 0.015, // epsilon for structuring points - CGAL::parameters::point_map (Point_map()). - normal_map (Normal_map()). - plane_map (CGAL::Shape_detection::Plane_map()). - plane_index_map (CGAL::Shape_detection::Point_to_shape_index_map(points, planes))); + CGAL::structure_point_set(points, + planes, + std::back_inserter(structured_pts), + 0.015, // epsilon for structuring points + CGAL::parameters::point_map(Point_map()) + .normal_map(Normal_map()) + .plane_map(CGAL::Shape_detection::Plane_map()) + .plane_index_map(CGAL::Shape_detection::Point_to_shape_index_map(points, planes))); std::cerr << structured_pts.size () << " structured point(s) generated." << std::endl; - std::ofstream out ("out.pwn"); - CGAL::write_XYZ (out, structured_pts, - CGAL::parameters::point_map(Point_map()).normal_map(Normal_map())); - out.close(); + CGAL::write_points("out.pwn", structured_pts, + CGAL::parameters::point_map(Point_map()) + .normal_map(Normal_map()) + .stream_precision(17)); return EXIT_SUCCESS; } 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 d81e664257b..524c080051b 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,7 +1,8 @@ #include + #include #include -#include +#include #include #include @@ -22,10 +23,9 @@ int main(int argc, char** argv) // Reads a .xyz point set file in points[] std::vector points; - if (!CGAL::read_points(input_filename, std::back_inserter(points))) + if(!CGAL::read_points(input_filename, std::back_inserter(points))) { std::cerr << "Error: cannot read file " << input_filename << std::endl; - return EXIT_FAILURE; } @@ -40,17 +40,8 @@ int main(int argc, char** argv) CGAL::parameters::select_percentage(retain_percentage). neighbor_radius (neighbor_radius)); - std::ofstream out(output_filename); - out.precision(17); - if (!out || !CGAL::write_XYZ( - out, output)) - { + if(!CGAL::write_points(output_filename, output, CGAL::parameters::stream_precision(17))) return EXIT_FAILURE; - } return EXIT_SUCCESS; } - - - - diff --git a/Point_set_processing_3/examples/Point_set_processing_3/write_ply_points_example.cpp b/Point_set_processing_3/examples/Point_set_processing_3/write_ply_points_example.cpp index 79b64f9546a..6542eb28ee6 100644 --- a/Point_set_processing_3/examples/Point_set_processing_3/write_ply_points_example.cpp +++ b/Point_set_processing_3/examples/Point_set_processing_3/write_ply_points_example.cpp @@ -1,4 +1,5 @@ #include + #include #include @@ -21,23 +22,24 @@ typedef CGAL::Nth_of_tuple_property_map<2, PCI> Intensity_map; // Define how a color should be stored namespace CGAL { - template< class F > - struct Output_rep< ::Color, F > { - const ::Color& c; - static const bool is_specialized = true; - Output_rep (const ::Color& c) : c(c) - { } - std::ostream& operator() (std::ostream& out) const - { - if (is_ascii(out)) - out << int(c[0]) << " " << int(c[1]) << " " << int(c[2]) << " " << int(c[3]); - else - out.write(reinterpret_cast(&c), sizeof(c)); - return out; - } - }; -} +template< class F > +struct Output_rep< ::Color, F > { + const ::Color& c; + static const bool is_specialized = true; + Output_rep (const ::Color& c) : c(c) + { } + std::ostream& operator() (std::ostream& out) const + { + if (is_ascii(out)) + out << int(c[0]) << " " << int(c[1]) << " " << int(c[2]) << " " << int(c[3]); + else + out.write(reinterpret_cast(&c), sizeof(c)); + return out; + } +}; + +} // namespace CGAL int main(int, char**) { @@ -54,15 +56,14 @@ int main(int, char**) std::ofstream f("out.ply", std::ios::binary); CGAL::set_binary_mode(f); // The PLY file will be written in the binary format - CGAL::write_PLY_with_properties - (f, points, - CGAL::make_ply_point_writer (Point_map()), - std::make_tuple(Color_map(), - CGAL::PLY_property("red"), - CGAL::PLY_property("green"), - CGAL::PLY_property("blue"), - CGAL::PLY_property("alpha")), - std::make_pair (Intensity_map(), CGAL::PLY_property("intensity"))); + CGAL::write_PLY_with_properties(f, points, + CGAL::make_ply_point_writer (Point_map()), + std::make_tuple(Color_map(), + CGAL::PLY_property("red"), + CGAL::PLY_property("green"), + CGAL::PLY_property("blue"), + CGAL::PLY_property("alpha")), + std::make_pair(Intensity_map(), CGAL::PLY_property("intensity"))); return EXIT_SUCCESS; } diff --git a/Shape_detection/examples/Shape_detection/region_growing_on_point_set_2.cpp b/Shape_detection/examples/Shape_detection/region_growing_on_point_set_2.cpp index 3eecfd572f3..f687faf4584 100644 --- a/Shape_detection/examples/Shape_detection/region_growing_on_point_set_2.cpp +++ b/Shape_detection/examples/Shape_detection/region_growing_on_point_set_2.cpp @@ -1,12 +1,3 @@ -// STL includes. -#include -#include -#include -#include -#include -#include -#include - // CGAL includes. #include #include @@ -16,6 +7,15 @@ #include #include +// STL includes. +#include +#include +#include +#include +#include +#include +#include + // Type declarations. using Kernel = CGAL::Simple_cartesian; diff --git a/Triangulation_3/demo/Triangulation_3/Scene.cpp b/Triangulation_3/demo/Triangulation_3/Scene.cpp index 6dd328495b0..c13c078abc5 100644 --- a/Triangulation_3/demo/Triangulation_3/Scene.cpp +++ b/Triangulation_3/demo/Triangulation_3/Scene.cpp @@ -6,8 +6,7 @@ #include #include -#include -#include +#include #include