From 924e337c9037eb3e467317b8a2882c3e3b664edb Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Thu, 28 Mar 2024 16:56:54 +1100 Subject: [PATCH] Don't consider borderline points to be inside a shape for more robust protrusion results --- src/ifcgeom_schema_agnostic/IfcGeomTree.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ifcgeom_schema_agnostic/IfcGeomTree.h b/src/ifcgeom_schema_agnostic/IfcGeomTree.h index 3928d3e7c1..c72da5e59f 100644 --- a/src/ifcgeom_schema_agnostic/IfcGeomTree.h +++ b/src/ifcgeom_schema_agnostic/IfcGeomTree.h @@ -251,6 +251,10 @@ namespace IfcGeom { */ double at, au, av; if (intersectRayTriangle(ray_origin, ray_vector, ta, tb, tc, at, au, av, false)) { + if (std::abs(at) < 1e-4) { + // The point is basically lying on a face so inside/outside is ambiguous. + return false; + } // At is a signed intersection distance (positive is along +ray_vector) if (at > -1e-5) { total_intersections++;