From be9ffa7322eb6823a05bbd57284be4cb66363afe Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Mon, 17 Sep 2018 14:59:15 +0200 Subject: [PATCH] Fail early on duplicate (non consecutive) points in face loops --- src/ifcgeom/IfcGeomFunctions.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/ifcgeom/IfcGeomFunctions.cpp b/src/ifcgeom/IfcGeomFunctions.cpp index a344d03526..9cc7f89b09 100644 --- a/src/ifcgeom/IfcGeomFunctions.cpp +++ b/src/ifcgeom/IfcGeomFunctions.cpp @@ -2921,6 +2921,15 @@ bool IfcGeom::Kernel::wire_intersections(const TopoDS_Wire& wire, TopTools_ListO tree.add(edge_idx++, exp.Current()); } } + + if (wd->NbEdges() != n) { + // If the number of edges differs, BRepTools_WireExplorer did not + // reach every edge, probably due to loops exactly at vertex locations. + // This is not supported by this algorithm which only elimates loops + // due to edge crossings. + + throw geometry_exception("Invalid loop"); + } bool intersected = false;