Unify input and make that output can be written simultaneously (for example during the testsuite)

This commit is contained in:
Andreas Fabri 2024-01-15 13:46:15 +00:00
parent 9a39ac9b61
commit 816a25895b
10 changed files with 26 additions and 25 deletions

View File

@ -58,7 +58,7 @@ int main(int, char**)
CGAL::Isosurfacing::dual_contouring(domain, 0.8, points, polygons); CGAL::Isosurfacing::dual_contouring(domain, 0.8, points, polygons);
// write output indexed surface mesh to file, in OFF format // write output indexed surface mesh to file, in OFF format
CGAL::IO::write_OFF("output.off", points, polygons); CGAL::IO::write_OFF("dual_contouring_Cartesian_grid.off", points, polygons);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -53,7 +53,7 @@ int main(int, char**)
CGAL::Isosurfacing::dual_contouring(domain, 0.0, points, polygons); CGAL::Isosurfacing::dual_contouring(domain, 0.0, points, polygons);
// save output to the OFF format // save output to the OFF format
CGAL::IO::write_OFF("output.off", points, polygons); CGAL::IO::write_OFF("dual_contouring_implicit_iwp.off", points, polygons);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -30,9 +30,10 @@ using Tree = CGAL::AABB_tree<Traits>;
using Point_range = std::vector<Point>; using Point_range = std::vector<Point>;
using Polygon_range = std::vector<std::vector<std::size_t> >; using Polygon_range = std::vector<std::vector<std::size_t> >;
int main(int, char**) int main(int argc, char* argv[])
{ {
const std::string input_name = CGAL::data_file_path("meshes/cross.off");
const std::string input_name = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/cross.off");
const Vector grid_spacing(0.1, 0.1, 0.1); const Vector grid_spacing(0.1, 0.1, 0.1);
const FT offset_value = 0.2; const FT offset_value = 0.2;
@ -79,7 +80,7 @@ int main(int, char**)
CGAL::Isosurfacing::dual_contouring(domain, offset_value, points, polygons); CGAL::Isosurfacing::dual_contouring(domain, offset_value, points, polygons);
// save output indexed mesh to a file, in the OFF format // save output indexed mesh to a file, in the OFF format
CGAL::IO::write_OFF("result.off", points, polygons); CGAL::IO::write_OFF("dual_contouring_mesh_offset.off", points, polygons);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -96,7 +96,7 @@ int main(int, char**)
CGAL::Isosurfacing::dual_contouring(domain, 0.8, points, polygons); CGAL::Isosurfacing::dual_contouring(domain, 0.8, points, polygons);
CGAL::IO::write_OFF("output.off", points, polygons); CGAL::IO::write_OFF("dual_contouring_octree.off", points, polygons);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -46,7 +46,7 @@ int main(int, char**)
CGAL::Isosurfacing::marching_cubes(domain, 0.8, points, triangles); CGAL::Isosurfacing::marching_cubes(domain, 0.8, points, triangles);
// save output indexed surface mesh to file, in the OFF format // save output indexed surface mesh to file, in the OFF format
CGAL::IO::write_OFF("output.off", points, triangles); CGAL::IO::write_OFF("marching_cubes_Cartesian_grid_sphere.off", points, triangles);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -44,7 +44,7 @@ int main(int, char**)
std::cout << "done (" << timer.time() << "s, " << triangles.size() << " triangles)" << std::endl; std::cout << "done (" << timer.time() << "s, " << triangles.size() << " triangles)" << std::endl;
// save ouput indexed mesh to a file, in the OFF format // save ouput indexed mesh to a file, in the OFF format
CGAL::IO::write_OFF("output.off", points, triangles); CGAL::IO::write_OFF("marching_cubes_implicit_sphere.off", points, triangles);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -15,9 +15,9 @@ using Grid = CGAL::Isosurfacing::Cartesian_grid_3<Kernel>;
using Point_range = std::vector<Point>; using Point_range = std::vector<Point>;
using Polygon_range = std::vector<std::vector<std::size_t> >; using Polygon_range = std::vector<std::vector<std::size_t> >;
int main(int, char**) int main(int argc, char* argv[])
{ {
const std::string fname = "../examples/Isosurfacing_3/FullHead.inr";//CGAL::data_file_path("images/skull_2.9.inr"); const std::string fname = (argc > 1) ? argv[1] : CGAL::data_file_path("images/skull_2.9.inr");
// load volumetric image from a file // load volumetric image from a file
CGAL::Image_3 image; CGAL::Image_3 image;
@ -46,7 +46,7 @@ int main(int, char**)
CGAL::Isosurfacing::marching_cubes(domain, 1120 /*isovalue*/, points, polygons); CGAL::Isosurfacing::marching_cubes(domain, 1120 /*isovalue*/, points, polygons);
// save output indexed mesh to a file, in the OFF format // save output indexed mesh to a file, in the OFF format
CGAL::IO::write_OFF("result.off", points, polygons); CGAL::IO::write_OFF("marching_cubes_inrimage.off", points, polygons);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@ -41,9 +41,9 @@ inline Kernel::FT distance_to_mesh(const Tree& tree,
} }
// Usage : marching_cubes_multiple_mesh_offsets input.off // Usage : marching_cubes_multiple_mesh_offsets input.off
int main(int argc, char **argv) int main(int argc, char *argv[])
{ {
const std::string input_name(argv[1]); const std::string input_name = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/cross.off");
std::cout << "Input file: " << input_name << std::endl; std::cout << "Input file: " << input_name << std::endl;

View File

@ -43,7 +43,7 @@ int main(int, char**)
CGAL::Isosurfacing::marching_cubes<CGAL::Sequential_tag>(domain, isovalue, points, triangles); CGAL::Isosurfacing::marching_cubes<CGAL::Sequential_tag>(domain, isovalue, points, triangles);
timer.stop(); timer.stop();
std::cout << "done (" << timer.time() << "s, " << triangles.size() << " triangles)" << std::endl; std::cout << "done (" << timer.time() << "s, " << triangles.size() << " triangles)" << std::endl;
CGAL::IO::write_OFF("output-seq.off", points, triangles); CGAL::IO::write_OFF("output-sequential.off", points, triangles);
// clear points and triangles // clear points and triangles
points.clear(); points.clear();

View File

@ -40,9 +40,9 @@ inline Kernel::FT distance_to_mesh(const Tree& tree,
return sqrt((p - x).squared_length()); return sqrt((p - x).squared_length());
} }
int main(int, char**) int main(int argc, char* argv[])
{ {
const std::string input_name = CGAL::data_file_path("meshes/cross.off"); const std::string input_name = (argc > 1) ? argv[1] :CGAL::data_file_path("meshes/cross.off");
const int n_voxels = 20; const int n_voxels = 20;
const FT offset_value = 0.2; const FT offset_value = 0.2;
@ -99,7 +99,7 @@ int main(int, char**)
CGAL::Isosurfacing::marching_cubes(domain, offset_value, points, polygons); CGAL::Isosurfacing::marching_cubes(domain, offset_value, points, polygons);
// save the output // save the output
CGAL::IO::write_polygon_soup("output.off", points, polygons); CGAL::IO::write_polygon_soup("marching_cubes_signed_mesh_offset.off", points, polygons);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }