Skip to content

Instantly share code, notes, and snippets.

@afabri
Created May 4, 2022 17:27
Show Gist options
  • Save afabri/8fab1d9fa97f135288395fe383ba604f to your computer and use it in GitHub Desktop.
Save afabri/8fab1d9fa97f135288395fe383ba604f to your computer and use it in GitHub Desktop.
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Surface_mesh.h>
#include <CGAL/boost/graph/generators.h>
#include <CGAL/Polygon_mesh_processing/IO/polygon_mesh_io.h>
#include <CGAL/Polygon_mesh_processing/repair.h>
#include <iostream>
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::Point_3 Point_3;
typedef CGAL::Surface_mesh<Point_3> Mesh;
namespace PMP = CGAL::Polygon_mesh_processing;
int main(int argc, char* argv[])
{
const std::string filename = (argc > 1) ? argv[1] : CGAL::data_file_path("meshes/blobby_3cc.off");
Mesh mesh;
/*
if(!PMP::IO::read_polygon_mesh(filename, mesh))
{
std::cerr << "Invalid input." << std::endl;
return 1;
}
*/
CGAL::make_triangle(Point_3(0,0,0), Point_3(1, 0, 0), Point_3(0, 1, 0), mesh);
CGAL::make_triangle(Point_3(0,0,1), Point_3(10, 0, 1), Point_3(0, 10, 1), mesh);
int n = PMP::remove_connected_components_of_negligible_size(mesh, CGAL::parameters::area_threshold(1.0).volume_threshold(0.0));
std::cerr << "n = " << n << std::endl;
std::cerr << mesh << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment