From e3b415ad5478719514832068bfb629f74e45b6bf Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Fri, 14 Dec 2018 17:14:55 +0100 Subject: [PATCH] Use miimal bounding box edge length for faceset relative epsilon --- src/ifcgeom/IfcGeomFunctions.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/ifcgeom/IfcGeomFunctions.cpp b/src/ifcgeom/IfcGeomFunctions.cpp index ebe87ada57..c6d47ba6e0 100644 --- a/src/ifcgeom/IfcGeomFunctions.cpp +++ b/src/ifcgeom/IfcGeomFunctions.cpp @@ -3618,7 +3618,18 @@ IfcGeom::Kernel::faceset_helper::faceset_helper(Kernel* kernel, const IfcSchema: } } - const double eps = kernel->getValue(GV_PRECISION) * 10. * std::sqrt(box.SquareExtent()); + // Find the minimal bounding box edge + double bmin[3], bmax[3]; + box.Get(bmin[0], bmin[1], bmin[2], bmax[0], bmax[1], bmax[2]); + double bdiff = std::numeric_limits::infinity(); + for (size_t i = 0; i < 3; ++i) { + const double d = bmax[i] - bmin[i]; + if (d > kernel->getValue(GV_PRECISION) * 10. && d < bdiff) { + bdiff = d; + } + } + + const double eps = kernel->getValue(GV_PRECISION) * 10. * bdiff; std::map, int> edge_use;