Tiny examples / tests fixes

This commit is contained in:
Mael Rouxel-Labbé 2023-01-09 11:06:21 +01:00
parent 4b3b9dda98
commit d7bc1ecc21
11 changed files with 28 additions and 28 deletions

View File

@ -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;
}

View File

@ -17,7 +17,7 @@ using Grid = CGAL::Cartesian_grid_3<Kernel>;
using Point_range = std::vector<Point>;
using Polygon_range = std::vector<std::vector<std::size_t> >;
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;
}

View File

@ -14,7 +14,7 @@ using Point = typename Kernel::Point_3;
using Point_range = std::vector<Point>;
using Polygon_range = std::vector<std::vector<std::size_t> >;
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;
}

View File

@ -30,7 +30,7 @@ using Tree = CGAL::AABB_tree<Traits>;
using Point_range = std::vector<Point>;
using Polygon_range = std::vector<std::vector<std::size_t> >;
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<Kernel>(aabb_grid, grid_spacing,
auto domain = CGAL::Isosurfacing::create_implicit_cartesian_grid_domain<Kernel>(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;
}

View File

@ -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_wrapper_> octree_wrap = std::make_shared<Octree_wrapper_>(bbox);
@ -98,5 +98,5 @@ int main()
CGAL::IO::write_OFF("result.off", points, polygons);
return 0;
return EXIT_SUCCESS;
}

View File

@ -19,7 +19,7 @@ using Grid = CGAL::Cartesian_grid_3<Kernel>;
using Point_range = std::vector<Point>;
using Polygon_range = std::vector<std::vector<std::size_t> >;
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;
}

View File

@ -17,7 +17,7 @@ using Point = typename Kernel::Point_3;
using Point_range = std::vector<Point>;
using Polygon_range = std::vector<std::vector<std::size_t> >;
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;
}

View File

@ -16,7 +16,7 @@ using Grid = CGAL::Cartesian_grid_3<Kernel>;
using Point_range = std::vector<Point>;
using Polygon_range = std::vector<std::vector<std::size_t> >;
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;
}

View File

@ -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;
}

View File

@ -25,7 +25,7 @@ using Grid = CGAL::Cartesian_grid_3<Kernel>;
using Point_range = std::vector<Point>;
using Polygon_range = std::vector<std::vector<std::size_t> >;
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;
}

View File

@ -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;
}