From d7bc1ecc21d01a5f4cdec2f3abc183ca8b76f061 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Mon, 9 Jan 2023 11:06:21 +0100 Subject: [PATCH] Tiny examples / tests fixes --- .../examples/Isosurfacing_3/all_cartesian_cube.cpp | 4 ++-- .../dual_contouring_cartesian_grid.cpp | 4 ++-- .../dual_contouring_implicit_iwp.cpp | 4 ++-- .../Isosurfacing_3/dual_contouring_mesh_offset.cpp | 14 +++++++------- .../Isosurfacing_3/dual_contouring_octree.cpp | 4 ++-- .../marching_cubes_cartesian_grid_sphere.cpp | 4 ++-- .../marching_cubes_implicit_sphere.cpp | 4 ++-- .../Isosurfacing_3/marching_cubes_inrimage.cpp | 4 ++-- .../marching_cubes_signed_mesh_offset.cpp | 6 +++--- .../test/Isosurfacing_3/test_dual_contouring.cpp | 4 ++-- .../test/Isosurfacing_3/test_marching_cubes.cpp | 4 ++-- 11 files changed, 28 insertions(+), 28 deletions(-) diff --git a/Isosurfacing_3/examples/Isosurfacing_3/all_cartesian_cube.cpp b/Isosurfacing_3/examples/Isosurfacing_3/all_cartesian_cube.cpp index 0ac93b130ae..e35d38af7f9 100644 --- a/Isosurfacing_3/examples/Isosurfacing_3/all_cartesian_cube.cpp +++ b/Isosurfacing_3/examples/Isosurfacing_3/all_cartesian_cube.cpp @@ -23,7 +23,7 @@ FT sign(FT value) return (value > 0.0) - (value < 0.0); } -int main() +int main(int, char**) { // create a Cartesian grid with 7^3 grid points and the bounding box [-1, 1]^3 const CGAL::Bbox_3 bbox(-1.0, -1.0, -1.0, 1.0, 1.0, 1.0); @@ -83,5 +83,5 @@ int main() CGAL::IO::write_OFF("result_mc.off", points_mc, polygons_mc); CGAL::IO::write_OFF("result_dc.off", points_dc, polygons_dc); - return 0; + return EXIT_SUCCESS; } diff --git a/Isosurfacing_3/examples/Isosurfacing_3/dual_contouring_cartesian_grid.cpp b/Isosurfacing_3/examples/Isosurfacing_3/dual_contouring_cartesian_grid.cpp index 399f172ed3e..87b389bd5d6 100644 --- a/Isosurfacing_3/examples/Isosurfacing_3/dual_contouring_cartesian_grid.cpp +++ b/Isosurfacing_3/examples/Isosurfacing_3/dual_contouring_cartesian_grid.cpp @@ -17,7 +17,7 @@ using Grid = CGAL::Cartesian_grid_3; using Point_range = std::vector; using Polygon_range = std::vector >; -int main() +int main(int, char**) { // create bounding box and grid const CGAL::Bbox_3 bbox(-1.0, -1.0, -1.0, 1.0, 1.0, 1.0); @@ -56,5 +56,5 @@ int main() // write output indexed surface mesh to file, in OFF format CGAL::IO::write_OFF("result.off", points, polygons); - return 0; + return EXIT_SUCCESS; } diff --git a/Isosurfacing_3/examples/Isosurfacing_3/dual_contouring_implicit_iwp.cpp b/Isosurfacing_3/examples/Isosurfacing_3/dual_contouring_implicit_iwp.cpp index 6888a06f3a9..d07277dee1b 100644 --- a/Isosurfacing_3/examples/Isosurfacing_3/dual_contouring_implicit_iwp.cpp +++ b/Isosurfacing_3/examples/Isosurfacing_3/dual_contouring_implicit_iwp.cpp @@ -14,7 +14,7 @@ using Point = typename Kernel::Point_3; using Point_range = std::vector; using Polygon_range = std::vector >; -int main() +int main(int, char**) { const FT alpha = 5.01; @@ -55,5 +55,5 @@ int main() // save the result in the OFF format CGAL::IO::write_OFF("result.off", points, polygons); - return 0; + return EXIT_SUCCESS; } diff --git a/Isosurfacing_3/examples/Isosurfacing_3/dual_contouring_mesh_offset.cpp b/Isosurfacing_3/examples/Isosurfacing_3/dual_contouring_mesh_offset.cpp index 62152acf13b..28e6c01b709 100644 --- a/Isosurfacing_3/examples/Isosurfacing_3/dual_contouring_mesh_offset.cpp +++ b/Isosurfacing_3/examples/Isosurfacing_3/dual_contouring_mesh_offset.cpp @@ -30,7 +30,7 @@ using Tree = CGAL::AABB_tree; using Point_range = std::vector; using Polygon_range = std::vector >; -int main() +int main(int, char**) { const std::string input_name = CGAL::data_file_path("meshes/cross.off"); const Vector grid_spacing(0.1, 0.1, 0.1); @@ -40,14 +40,14 @@ int main() if(!CGAL::IO::read_OFF(input_name, mesh_input)) { std::cerr << "Could not read input mesh" << std::endl; - exit(-1); + return EXIT_FAILURE; } // compute bounding box - CGAL::Bbox_3 aabb_grid = CGAL::Polygon_mesh_processing::bbox(mesh_input); + CGAL::Bbox_3 bbox = CGAL::Polygon_mesh_processing::bbox(mesh_input); Vector aabb_increase_vec = Vector(offset_value + 0.01, offset_value + 0.01, offset_value + 0.01); - aabb_grid += (Point(aabb_grid.xmax(), aabb_grid.ymax(), aabb_grid.zmax()) + aabb_increase_vec).bbox(); - aabb_grid += (Point(aabb_grid.xmin(), aabb_grid.ymin(), aabb_grid.zmin()) - aabb_increase_vec).bbox(); + bbox += (Point(bbox.xmax(), bbox.ymax(), bbox.zmax()) + aabb_increase_vec).bbox(); + bbox += (Point(bbox.xmin(), bbox.ymin(), bbox.zmin()) - aabb_increase_vec).bbox(); // construct AABB tree Tree tree(mesh_input.faces_begin(), mesh_input.faces_end(), mesh_input); @@ -69,7 +69,7 @@ int main() }; // create a domain with given bounding box and grid spacing - auto domain = CGAL::Isosurfacing::create_implicit_cartesian_grid_domain(aabb_grid, grid_spacing, + auto domain = CGAL::Isosurfacing::create_implicit_cartesian_grid_domain(bbox, grid_spacing, mesh_distance, mesh_normal); // containers for output indexed surface mesh Point_range points; @@ -81,5 +81,5 @@ int main() // save output indexed mesh to a file, in the OFF format CGAL::IO::write_OFF("result.off", points, polygons); - return 0; + return EXIT_SUCCESS; } diff --git a/Isosurfacing_3/examples/Isosurfacing_3/dual_contouring_octree.cpp b/Isosurfacing_3/examples/Isosurfacing_3/dual_contouring_octree.cpp index 9fe5e1337bf..c56c22bd25d 100644 --- a/Isosurfacing_3/examples/Isosurfacing_3/dual_contouring_octree.cpp +++ b/Isosurfacing_3/examples/Isosurfacing_3/dual_contouring_octree.cpp @@ -70,7 +70,7 @@ struct Refine_one_eighth } }; -int main() +int main(int, char**) { const CGAL::Bbox_3 bbox(-1., -1., -1., 1., 1., 1.); std::shared_ptr octree_wrap = std::make_shared(bbox); @@ -98,5 +98,5 @@ int main() CGAL::IO::write_OFF("result.off", points, polygons); - return 0; + return EXIT_SUCCESS; } diff --git a/Isosurfacing_3/examples/Isosurfacing_3/marching_cubes_cartesian_grid_sphere.cpp b/Isosurfacing_3/examples/Isosurfacing_3/marching_cubes_cartesian_grid_sphere.cpp index fc1d2fb6a87..27106849c63 100644 --- a/Isosurfacing_3/examples/Isosurfacing_3/marching_cubes_cartesian_grid_sphere.cpp +++ b/Isosurfacing_3/examples/Isosurfacing_3/marching_cubes_cartesian_grid_sphere.cpp @@ -19,7 +19,7 @@ using Grid = CGAL::Cartesian_grid_3; using Point_range = std::vector; using Polygon_range = std::vector >; -int main() +int main(int, char**) { // create a Cartesian grid with 100^3 grid points and the bounding box [-1, 1]^3 const CGAL::Bbox_3 bbox(-1.0, -1.0, -1.0, 1.0, 1.0, 1.0); @@ -53,5 +53,5 @@ int main() // save output indexed surface mesh to file, in the OFF format CGAL::IO::write_OFF("result.off", points, polygons); - return 0; + return EXIT_SUCCESS; } diff --git a/Isosurfacing_3/examples/Isosurfacing_3/marching_cubes_implicit_sphere.cpp b/Isosurfacing_3/examples/Isosurfacing_3/marching_cubes_implicit_sphere.cpp index ed7fbe505cb..c3ae527f4a8 100644 --- a/Isosurfacing_3/examples/Isosurfacing_3/marching_cubes_implicit_sphere.cpp +++ b/Isosurfacing_3/examples/Isosurfacing_3/marching_cubes_implicit_sphere.cpp @@ -17,7 +17,7 @@ using Point = typename Kernel::Point_3; using Point_range = std::vector; using Polygon_range = std::vector >; -int main() +int main(int, char**) { const CGAL::Bbox_3 bbox { -1.0, -1.0, -1.0, 1.0, 1.0, 1.0 }; const FT spacing = 0.04; @@ -42,5 +42,5 @@ int main() // save ouput indexed mesh to a file, in the OFF format CGAL::IO::write_OFF("result.off", points, polygons); - return 0; + return EXIT_SUCCESS; } diff --git a/Isosurfacing_3/examples/Isosurfacing_3/marching_cubes_inrimage.cpp b/Isosurfacing_3/examples/Isosurfacing_3/marching_cubes_inrimage.cpp index 081454a432e..96ae599a5cc 100644 --- a/Isosurfacing_3/examples/Isosurfacing_3/marching_cubes_inrimage.cpp +++ b/Isosurfacing_3/examples/Isosurfacing_3/marching_cubes_inrimage.cpp @@ -16,7 +16,7 @@ using Grid = CGAL::Cartesian_grid_3; using Point_range = std::vector; using Polygon_range = std::vector >; -int main() +int main(int, char**) { const std::string fname = CGAL::data_file_path("images/skull_2.9.inr"); @@ -44,5 +44,5 @@ int main() // save output indexed mesh to a file, in the OFF format CGAL::IO::write_OFF("result.off", points, polygons); - return 0; + return EXIT_SUCCESS; } diff --git a/Isosurfacing_3/examples/Isosurfacing_3/marching_cubes_signed_mesh_offset.cpp b/Isosurfacing_3/examples/Isosurfacing_3/marching_cubes_signed_mesh_offset.cpp index 31b7a8615ed..1e87e345cc8 100644 --- a/Isosurfacing_3/examples/Isosurfacing_3/marching_cubes_signed_mesh_offset.cpp +++ b/Isosurfacing_3/examples/Isosurfacing_3/marching_cubes_signed_mesh_offset.cpp @@ -41,7 +41,7 @@ inline Kernel::FT distance_to_mesh(const Tree& tree, return std::sqrt((p - x).squared_length()); } -int main() +int main(int, char**) { const std::string input_name = CGAL::data_file_path("meshes/cross.off"); const int n_voxels = 20; @@ -52,7 +52,7 @@ int main() if(!CGAL::IO::read_OFF(input_name, mesh_input)) { std::cerr << "Could not read input mesh" << std::endl; - exit(-1); + return EXIT_FAILURE; } // compute loose bounding box of the mesh @@ -102,5 +102,5 @@ int main() // save output indexed triangle soup to a file, in the OFF format CGAL::IO::write_OFF("output.off", points, polygons); - return 0; + return EXIT_SUCCESS; } diff --git a/Isosurfacing_3/test/Isosurfacing_3/test_dual_contouring.cpp b/Isosurfacing_3/test/Isosurfacing_3/test_dual_contouring.cpp index 226303ce1d7..0b11f074512 100644 --- a/Isosurfacing_3/test/Isosurfacing_3/test_dual_contouring.cpp +++ b/Isosurfacing_3/test/Isosurfacing_3/test_dual_contouring.cpp @@ -25,7 +25,7 @@ using Grid = CGAL::Cartesian_grid_3; using Point_range = std::vector; using Polygon_range = std::vector >; -int main() +int main(int, char**) { const Vector spacing(0.002, 0.002, 0.02); const CGAL::Bbox_3 bbox = {-1, -1, -1, 1, 1, 1}; @@ -87,5 +87,5 @@ int main() // CGAL::IO::write_OFF("result.off", mesh); CGAL::IO::write_OFF("result.off", points, polygons); - return 0; + return EXIT_SUCCESS; } diff --git a/Isosurfacing_3/test/Isosurfacing_3/test_marching_cubes.cpp b/Isosurfacing_3/test/Isosurfacing_3/test_marching_cubes.cpp index 74db4d4b32e..aade1870a41 100644 --- a/Isosurfacing_3/test/Isosurfacing_3/test_marching_cubes.cpp +++ b/Isosurfacing_3/test/Isosurfacing_3/test_marching_cubes.cpp @@ -94,7 +94,7 @@ void test_grid_sphere(const std::size_t n) std::cout << "Test passed: " << test_name << std::endl; } -int main() +int main(int, char**) { test_implicit_sphere(); test_grid_sphere(2); @@ -105,5 +105,5 @@ int main() std::cout << "All tests passed" << std::endl; - return 0; + return EXIT_SUCCESS; }