Skip to content

Instantly share code, notes, and snippets.

@sloriot
Created July 9, 2018 16:01
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 sloriot/ddcc88f9a7fea383a586f05fca1629c3 to your computer and use it in GitHub Desktop.
Save sloriot/ddcc88f9a7fea383a586f05fca1629c3 to your computer and use it in GitHub Desktop.
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/Polygon_mesh_processing/corefinement.h>
#include <CGAL/Polygon_mesh_processing/connected_components.h>
#include <CGAL/Polygon_mesh_processing/stitch_borders.h>
#include <fstream>
#include <sstream>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Surface_mesh<K::Point_3> Surface_mesh;
namespace PMP = CGAL::Polygon_mesh_processing;
int main(int, const char** argv)
{
std::ifstream input(argv[1]);
Surface_mesh tm;
input >> tm;
Surface_mesh::Property_map<Surface_mesh::Edge_index, bool> ecm =
tm.add_property_map<Surface_mesh::Edge_index, bool>("ecm", false).first;
PMP::experimental::autorefine(tm, PMP::parameters::edge_is_constrained_map(ecm));
PMP::keep_largest_connected_components(tm, 1, PMP::parameters::edge_is_constrained_map(ecm));
PMP::stitch_borders(tm);
std::ofstream output("out.off");
output << std::setprecision(17);
output << tm;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment