From b6a7ba1e1cbf37a8d95d5794ed6be1b120117dde Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Sun, 26 Jan 2020 13:58:02 +0100 Subject: [PATCH] Fix for open polyhedra --- src/ifcconvert/validation_utils.h | 5 +++++ src/ifcgeom/kernels/cgal/CgalKernel.cpp | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ifcconvert/validation_utils.h b/src/ifcconvert/validation_utils.h index eca3406563..382603371f 100644 --- a/src/ifcconvert/validation_utils.h +++ b/src/ifcconvert/validation_utils.h @@ -481,6 +481,11 @@ struct intersection_validator { } CGAL::Nef_polyhedron_3 nef = ifcopenshell::geometry::utils::create_nef_polyhedron(s); + if (nef.is_empty()) { + std::wcout << "Failed to create nef" << std::endl; + continue; + } + nef = CGAL::minkowski_sum_3(nef, cube); std::wcout << "product: " << geom_object->product() << std::endl; nefs.push_back({ geom_object->product(), nef }); diff --git a/src/ifcgeom/kernels/cgal/CgalKernel.cpp b/src/ifcgeom/kernels/cgal/CgalKernel.cpp index 190a851470..3d6e76d9c8 100644 --- a/src/ifcgeom/kernels/cgal/CgalKernel.cpp +++ b/src/ifcgeom/kernels/cgal/CgalKernel.cpp @@ -94,7 +94,8 @@ CGAL::Nef_polyhedron_3 ifcopenshell::geometry::utils::create_nef_polyhe } CGAL::Nef_polyhedron_3 ifcopenshell::geometry::utils::create_nef_polyhedron(CGAL::Polyhedron_3 &polyhedron) { - if (polyhedron.is_valid()) { + if (polyhedron.is_valid() && polyhedron.is_closed()) { + // @todo is it necessary to triangulat? CGAL::Polygon_mesh_processing::triangulate_faces(polyhedron); CGAL::Nef_polyhedron_3 nef_polyhedron; try {