From 0ffa633a6da9822387286ebe820d678c27d129d3 Mon Sep 17 00:00:00 2001 From: Ken Arroyo Ohori Date: Thu, 16 Mar 2017 19:30:39 -0600 Subject: [PATCH] Better validation --- .../kernels/cgal/CgalConversionFunctions.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/ifcgeom/kernels/cgal/CgalConversionFunctions.cpp b/src/ifcgeom/kernels/cgal/CgalConversionFunctions.cpp index b44429d144..b42d90bcdf 100644 --- a/src/ifcgeom/kernels/cgal/CgalConversionFunctions.cpp +++ b/src/ifcgeom/kernels/cgal/CgalConversionFunctions.cpp @@ -341,11 +341,20 @@ CGAL::Nef_polyhedron_3 IfcGeom::CgalKernel::create_nef_polyhedron(std::l // std::cout << "Before: " << polyhedron.size_of_vertices() << " vertices and " << polyhedron.size_of_facets() << " facets" << std::endl; CGAL::Polygon_mesh_processing::stitch_borders(polyhedron); if (!polyhedron.is_valid()) { - std::cout << "Invalid polyhedron!" << std::endl; + std::cout << "Polyhedron not valid!" << std::endl; std::ofstream fresult; fresult.open("/Users/ken/Desktop/invalid.off"); - fresult << old_polyhedron << std::endl; + fresult << polyhedron << std::endl; fresult.close(); + return CGAL::Nef_polyhedron_3(); + } if (!polyhedron.is_closed()) { + std::cout << "Polyhedron not closed" << std::endl; + std::ofstream fresult; + fresult.open("/Users/ken/Desktop/open.off"); + fresult << polyhedron << std::endl; + fresult.close(); + // TODO: Nef constructor doesn't support open meshes + return CGAL::Nef_polyhedron_3(polyhedron); } if (!CGAL::Polygon_mesh_processing::is_outward_oriented(polyhedron)) { CGAL::Polygon_mesh_processing::reverse_face_orientations(polyhedron);