From 3101ccb83a96a36367ce89a4570cb78fd2af073c Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Mon, 17 Sep 2018 14:42:22 +0200 Subject: [PATCH] Fixes for degenerate polylines --- src/ifcgeom/IfcGeomWires.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ifcgeom/IfcGeomWires.cpp b/src/ifcgeom/IfcGeomWires.cpp index 99ad42099e..704e8abbb7 100644 --- a/src/ifcgeom/IfcGeomWires.cpp +++ b/src/ifcgeom/IfcGeomWires.cpp @@ -492,7 +492,7 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcPolyline* l, TopoDS_Wire& resu } const double eps = getValue(GV_PRECISION) * 10; - const bool closed_by_proximity = polygon.Length() >= 2 && polygon.First().Distance(polygon.Last()) < eps; + const bool closed_by_proximity = polygon.Length() >= 3 && polygon.First().Distance(polygon.Last()) < eps; if (closed_by_proximity) { // tfk: note 1-based polygon.Remove(polygon.Length()); @@ -500,6 +500,10 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcPolyline* l, TopoDS_Wire& resu // Remove points that are too close to one another remove_duplicate_points_from_loop(polygon, closed_by_proximity, eps); + + if (polygon.Length() < 2) { + return false; + } BRepBuilderAPI_MakePolygon w; for (int i = 1; i <= polygon.Length(); ++i) {