diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair.h index 9910f0538c9..800f8e799f1 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair.h @@ -39,6 +39,13 @@ #include #include +#ifdef CGAL_PMP_REMOVE_DEGENERATE_FACES_DEBUG +#include +#include +#include +#include +#endif + namespace CGAL{ namespace Polygon_mesh_processing { @@ -758,6 +765,22 @@ std::size_t remove_degenerate_faces(TriangleMesh& tmesh, { #ifdef CGAL_PMP_REMOVE_DEGENERATE_FACES_DEBUG std::cout << "Loop on removing deg faces\n"; + // ensure the mesh is not broken + { + std::ofstream out("/tmp/out.off"); + out << tmesh; + out.close(); + + std::vector points; + std::vector > triangles; + std::ifstream in("/tmp/out.off"); + CGAL::read_OFF(in, points, triangles); + if (!CGAL::Polygon_mesh_processing::is_polygon_soup_a_polygon_mesh(triangles)) + { + std::cerr << "ERROR: got a polygon soup!\n"; + exit(EXIT_FAILURE); + } + } #endif CGAL_assertion(is_valid_polygon_mesh(tmesh)); @@ -1157,6 +1180,10 @@ bool remove_self_intersections(TriangleMesh& tm, const int max_steps = 7, bool v typedef typename graph_traits::vertex_descriptor vertex_descriptor; typedef typename graph_traits::edge_descriptor edge_descriptor; + +// TODO: the first thing to do it to collect degenerate faces and no consider then +// for the self-intersection detection (otherwise we'll get some errors) + // Look for self-intersections in the polyhedron and remove them int step=-1; std::vector non_filled_hole;