Skip to content

Instantly share code, notes, and snippets.

@stiklaz
Created April 30, 2020 13:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stiklaz/39ee8ecf6827d25502900831d9f3e3aa to your computer and use it in GitHub Desktop.
Save stiklaz/39ee8ecf6827d25502900831d9f3e3aa to your computer and use it in GitHub Desktop.
void CMeshOp::Test()
{
Surface_mesh mesh_end_1;
std::fstream file_end_1("mesh_end1.off");
file_end_1 >> mesh_end_1;
Surface_mesh mesh_end_2;
std::fstream file_end_2("mesh_end2.off");
file_end_2 >> mesh_end_2;
Surface_mesh mesh_main;
std::fstream file_to_cut("mesh_main.off");
file_to_cut >> mesh_main;
Surface_mesh mesh_with_cut1;
const bool bFirstCut = CGAL::Polygon_mesh_processing::corefine_and_compute_difference(mesh_main, mesh_end_1, mesh_with_cut1, CGAL::parameters::throw_on_self_intersection(true));
Surface_mesh mesh_result;
const bool bSecondCut = CGAL::Polygon_mesh_processing::corefine_and_compute_difference(mesh_with_cut1, mesh_end_2, mesh_result, CGAL::parameters::throw_on_self_intersection(true));
if (bFirstCut) {
std::ofstream file_result_1cut("mesh_with_cut1.off");
if (file_result_1cut.is_open()) {
file_result_1cut << mesh_with_cut1;
file_result_1cut.close();
}
}
if (bSecondCut) {
std::ofstream file_result_2cuts("mesh_result.off");
if (file_result_2cuts.is_open()) {
file_result_2cuts << mesh_result;
file_result_2cuts.close();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment