From e9bbe64115e2c5435300eb8cee4df4751e075c4c Mon Sep 17 00:00:00 2001 From: Alexander Gessler Date: Mon, 21 Jan 2013 22:46:11 +0100 Subject: [PATCH] - Ifc: fine-tune epsilons. Correct epsilon approximation for a squared value is max(e^2 +- 2e). --- code/IFCGeometry.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/code/IFCGeometry.cpp b/code/IFCGeometry.cpp index ac335be77..563228556 100644 --- a/code/IFCGeometry.cpp +++ b/code/IFCGeometry.cpp @@ -1462,6 +1462,7 @@ bool IntersectingLineSegments(const IfcVector2& n0, const IfcVector2& n1, // ------------------------------------------------------------------------------------------------ void FindAdjacentContours(ContourVector::iterator current, const ContourVector& contours) { + const IfcFloat sqlen_epsilon = static_cast(1e-8); const BoundingBox& bb = (*current).bb; // What is to be done here is to populate the skip lists for the contour @@ -1507,7 +1508,7 @@ void FindAdjacentContours(ContourVector::iterator current, const ContourVector& IfcVector2 isect0, isect1; if (IntersectingLineSegments(n0,n1, m0, m1, isect0, isect1)) { - if ((isect0 - n0).SquareLength() > 1e-5) { + if ((isect0 - n0).SquareLength() > sqlen_epsilon) { ++n; ncontour.insert(ncontour.begin() + n, isect0); @@ -1517,7 +1518,7 @@ void FindAdjacentContours(ContourVector::iterator current, const ContourVector& skiplist[n] = true; } - if ((isect1 - n1).SquareLength() > 1e-5) { + if ((isect1 - n1).SquareLength() > sqlen_epsilon) { ++n; ncontour.insert(ncontour.begin() + n, isect1);