diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/data/full_border_quads.off b/Polygon_mesh_processing/examples/Polygon_mesh_processing/data/full_border_quads.off new file mode 100644 index 00000000000..b2a89dc80f4 --- /dev/null +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/data/full_border_quads.off @@ -0,0 +1,32 @@ +OFF +20 8 0 +1 0 0 +0.75 0 0 +0.5 0 0 +0.25 0 0 +0 0 0 +0 1 0 +0.25 1 0 +0.5 1 0 +0.75 1 0 +1 1 0 +1 1 0 +0.75 1 0 +0.5 1 0 +0.25 1 0 +0 1 0 +0 2 0 +0.25 2 0 +0.5 2 0 +0.75 2 0 +1 2 0 +4 5 6 3 4 +4 3 6 7 2 +4 1 2 7 8 +4 1 8 9 0 +4 15 16 13 14 +4 13 16 17 12 +4 11 12 17 18 +4 11 18 19 10 + + diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/stitch_borders_example.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/stitch_borders_example.cpp index b46ba7e3ee2..e629d5fbb8a 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/stitch_borders_example.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/stitch_borders_example.cpp @@ -1,9 +1,37 @@ + +#include +#include +#include + #include -// CGAL::Polygon_mesh_processing::stitch_borders() +#include +#include +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; +typedef K::Point_3 Point_3; +typedef CGAL::Surface_mesh Surface_mesh; int main() { + Surface_mesh mesh; + std::ifstream input("data/full_border_quads.off"); + if (!input || !(input >> mesh) || mesh.is_empty()) { + std::cerr << "Not a valid off file." << std::endl; + return 1; + } + + std::cout << "Before stitching : " << std::endl; + std::cout << "\t Number of vertices :\t" << mesh.number_of_vertices() << std::endl; + std::cout << "\t Number of edges :\t" << mesh.number_of_edges() << std::endl; + std::cout << "\t Number of facets :\t" << mesh.number_of_faces() << std::endl; + + CGAL::Polygon_mesh_processing::stitch_borders(mesh); + + std::cout << "Stitching done : " << std::endl; + std::cout << "\t Number of vertices :\t" << mesh.number_of_vertices() << std::endl; + std::cout << "\t Number of edges :\t" << mesh.number_of_edges() << std::endl; + std::cout << "\t Number of facets :\t" << mesh.number_of_faces() << std::endl; + return 0; }