Browse Source

- Ifc: fine-tune epsilons. Correct epsilon approximation for a squared value is max(e^2 +- 2e).

Alexander Gessler 12 years ago
parent
commit
e9bbe64115
1 changed files with 3 additions and 2 deletions
  1. 3 2
      code/IFCGeometry.cpp

+ 3 - 2
code/IFCGeometry.cpp

@@ -1462,6 +1462,7 @@ bool IntersectingLineSegments(const IfcVector2& n0, const IfcVector2& n1,
 // ------------------------------------------------------------------------------------------------
 // ------------------------------------------------------------------------------------------------
 void FindAdjacentContours(ContourVector::iterator current, const ContourVector& contours)
 void FindAdjacentContours(ContourVector::iterator current, const ContourVector& contours)
 {
 {
+	const IfcFloat sqlen_epsilon = static_cast<IfcFloat>(1e-8);
 	const BoundingBox& bb = (*current).bb;
 	const BoundingBox& bb = (*current).bb;
 
 
 	// What is to be done here is to populate the skip lists for the contour
 	// 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;
 					IfcVector2 isect0, isect1;
 					if (IntersectingLineSegments(n0,n1, m0, m1, isect0, isect1)) {
 					if (IntersectingLineSegments(n0,n1, m0, m1, isect0, isect1)) {
 
 
-						if ((isect0 - n0).SquareLength() > 1e-5) {
+						if ((isect0 - n0).SquareLength() > sqlen_epsilon) {
 							++n;
 							++n;
 
 
 							ncontour.insert(ncontour.begin() + n, isect0);	
 							ncontour.insert(ncontour.begin() + n, isect0);	
@@ -1517,7 +1518,7 @@ void FindAdjacentContours(ContourVector::iterator current, const ContourVector&
 							skiplist[n] = true;
 							skiplist[n] = true;
 						}
 						}
 
 
-						if ((isect1 - n1).SquareLength() > 1e-5) {
+						if ((isect1 - n1).SquareLength() > sqlen_epsilon) {
 							++n;
 							++n;
 
 
 							ncontour.insert(ncontour.begin() + n, isect1);
 							ncontour.insert(ncontour.begin() + n, isect1);