[med-svn] [opensurgsim] 01/01: Fix floating point precision error in GeometryTest

Paul Novotny paulnovo-guest at moszumanska.debian.org
Sun Sep 20 16:26:40 UTC 2015


This is an automated email from the git hooks/post-receive script.

paulnovo-guest pushed a commit to branch master
in repository opensurgsim.

commit 5fe9b0dded463c58e0fe6d0214275a4dcd815561
Author: Paul Novotny <paul at paulnovo.us>
Date:   Sun Sep 20 12:24:51 2015 -0400

    Fix floating point precision error in GeometryTest
    
    On arm64 another floating point precision error was seen in
    GeomtryTest.TrianglePlaneTest.
---
 debian/patches/fix-epsilon-for-tests.patch | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/debian/patches/fix-epsilon-for-tests.patch b/debian/patches/fix-epsilon-for-tests.patch
index ec70aad..fe97f66 100644
--- a/debian/patches/fix-epsilon-for-tests.patch
+++ b/debian/patches/fix-epsilon-for-tests.patch
@@ -1,13 +1,13 @@
 Description: Fixes failing tests due to floating point precision
  On arm64, ppc64el, powerpc, and ppc64 the
- GeometryTest.SegmentTriangleIntersection and
+ GeometryTest.SegmentTriangleIntersection, GeometryTest.TrianglePlaneTest and
  Fem3DElementTetrahedronTests.ForceAndMatricesTest unit tests were failing due
  to floating point precision issues. This loosens the equality epsilon in the
  Fem3DElementTetrahedronTests and uses an epsilon when doing floating point
  comparisons in doesCollideSegmentTriangle.
 Author: Paul Novotny <paul at paulnovo.us>
 Bug-Debian: https://bugs.debian.org/798717
-Last-Update: 2015-09-19
+Last-Update: 2015-09-20
 
 --- a/SurgSim/Math/Geometry.h
 +++ b/SurgSim/Math/Geometry.h
@@ -47,3 +47,14 @@ Last-Update: 2015-09-19
  };
  
  class MockFem3DElementTet : public Fem3DElementTetrahedron
+--- a/SurgSim/Math/UnitTests/GeometryTests.cpp
++++ b/SurgSim/Math/UnitTests/GeometryTests.cpp
+@@ -1041,7 +1041,7 @@
+ 
+ 	distance = distanceTrianglePlane(tri.v0, tri.v1, tri.v2, n, d, &triangleResultPoint, &planeResultPoint);
+ 	EXPECT_NEAR((planeResultPoint - triangleResultPoint).norm(), std::abs(distance), epsilon);
+-	EXPECT_TRUE(distance * sign > 0 || distance == static_cast<double>(sign));
++	EXPECT_TRUE((sign == 0 && std::abs(distance) <= epsilon) || (distance * sign > 0));
+ 	EXPECT_TRUE(expectedTrianglePoint.isApprox(triangleResultPoint));
+ 	EXPECT_TRUE(expectedPlanePoint.isApprox(planeResultPoint));
+ }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/opensurgsim.git



More information about the debian-med-commit mailing list