mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 06:58:56 +00:00
Test for self-intersection before converting to nef
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
#include "CgalKernel.h"
|
#include "CgalKernel.h"
|
||||||
|
|
||||||
#include <CGAL/Polygon_mesh_processing/repair.h>
|
#include <CGAL/Polygon_mesh_processing/repair.h>
|
||||||
|
#include <CGAL/Polygon_mesh_processing/self_intersections.h>
|
||||||
|
|
||||||
#include "../../../ifcparse/IfcLogger.h"
|
#include "../../../ifcparse/IfcLogger.h"
|
||||||
#include "../../../ifcgeom/IfcGeomRepresentation.h"
|
#include "../../../ifcgeom/IfcGeomRepresentation.h"
|
||||||
@@ -34,6 +35,9 @@ void ifcopenshell::geometry::CgalShape::to_poly() const {
|
|||||||
|
|
||||||
void ifcopenshell::geometry::CgalShape::to_nef() const {
|
void ifcopenshell::geometry::CgalShape::to_nef() const {
|
||||||
if (!nef_) {
|
if (!nef_) {
|
||||||
|
if (CGAL::Polygon_mesh_processing::does_self_intersect(*shape_)) {
|
||||||
|
throw std::runtime_error("Self-intersections detected, unable to proceed");
|
||||||
|
}
|
||||||
nef_ = utils::create_nef_polyhedron(*shape_);
|
nef_ = utils::create_nef_polyhedron(*shape_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user