[med-svn] [opensurgsim] 01/01: Fixes unit tests off on some architectures (Closes: #798717)

Paul Novotny paulnovo-guest at moszumanska.debian.org
Sat Sep 19 16:37:09 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 2dc9db2a39a03ee22c3c1e4adaae76ee7ab7de53
Author: Paul Novotny <paul at paulnovo.us>
Date:   Sat Sep 19 12:28:53 2015 -0400

    Fixes unit tests off on some architectures (Closes: #798717)
---
 debian/patches/backport-7b1d8836f.patch    | 34 +++++++++++++++++++++
 debian/patches/backport-c7925c91f.patch    | 37 ++++++++++++++++++++++
 debian/patches/fix-epsilon-for-tests.patch | 49 ++++++++++++++++++++++++++++++
 debian/patches/fix-timer.patch             |  3 +-
 debian/patches/series                      |  3 ++
 5 files changed, 125 insertions(+), 1 deletion(-)

diff --git a/debian/patches/backport-7b1d8836f.patch b/debian/patches/backport-7b1d8836f.patch
new file mode 100644
index 0000000..b47ef72
--- /dev/null
+++ b/debian/patches/backport-7b1d8836f.patch
@@ -0,0 +1,34 @@
+Description: Fixes TriangleMeshTriangleMeshContactCalculationTests [Patch 2/2]
+ The NonintersectionTest unit test was failing on arm64, ppc64el, s390x, and
+ ppc64. This was addressed upstream in two commits.
+Author: Paul Novotny <paul at paulnovo.us>
+Origin: upstream, https://github.com/simquest/opensurgsim/commit/7b1d8836f
+Bug-Debian: https://bugs.debian.org/798717
+Last-Update: 2015-09-19
+
+--- a/SurgSim/Math/TriangleTriangleIntersection-inl.h
++++ b/SurgSim/Math/TriangleTriangleIntersection-inl.h
+@@ -136,7 +136,7 @@
+ 	size_t s1Index = 0;
+ 	size_t s2Index = 0;
+ 
+-	// Loop through the edges of each triangle and find the intersectio of these edges onto
++	// Loop through the edges of each triangle and find the intersection of these edges onto
+ 	// the plane of the other triangle.
+ 	for (int i = 0; i < 3; ++i)
+ 	{
+@@ -150,8 +150,12 @@
+ 			<< "The intersection between the triangle and the separating axis is not a line segment."
+ 			<< " This scenario cannot happen, at this point in the algorithm.";
+ 
+-	return !(std::abs(s1[0] - s2[0]) <= DistanceEpsilon && std::abs(s1[0] - s2[1]) <= DistanceEpsilon &&
+-		     std::abs(s1[1] - s2[0]) <= DistanceEpsilon && std::abs(s1[1] - s2[1]) <= DistanceEpsilon) &&
++	// s1[0], s1[1] are the (unordered) extents of the projection of T1 on D.
++	// s2[0], s2[1] are the (unordered) extents of the projection of T2 on D.
++	// If both these are line segments (i.e. the distance between them is > epsilon),
++	// and if they overlap, then the two triangles intersect.
++
++	return !(std::abs(s1[0] - s1[1]) <= DistanceEpsilon && std::abs(s2[0] - s2[1]) <= DistanceEpsilon) &&
+ 		   !(s1[0] <= s2[0] && s1[0] <= s2[1] && s1[1] <= s2[0] && s1[1] <= s2[1]) &&
+ 		   !(s1[0] >= s2[0] && s1[0] >= s2[1] && s1[1] >= s2[0] && s1[1] >= s2[1]);
+ }
diff --git a/debian/patches/backport-c7925c91f.patch b/debian/patches/backport-c7925c91f.patch
new file mode 100644
index 0000000..a239535
--- /dev/null
+++ b/debian/patches/backport-c7925c91f.patch
@@ -0,0 +1,37 @@
+Description: Fixes TriangleMeshTriangleMeshContactCalculationTests [Patch 1/2]
+ The NonintersectionTest unit test was failing on arm64, ppc64el, s390x, and
+ ppc64. This was addressed upstream in two commits.
+Author: Paul Novotny <paul at paulnovo.us>
+Origin: upstream, https://github.com/simquest/opensurgsim/commit/c7925c91f
+Bug-Debian: https://bugs.debian.org/798717
+Last-Update: 2015-09-19
+
+--- a/SurgSim/Math/TriangleTriangleIntersection-inl.h
++++ b/SurgSim/Math/TriangleTriangleIntersection-inl.h
+@@ -16,7 +16,6 @@
+ #ifndef SURGSIM_MATH_TRIANGLETRIANGLEINTERSECTION_INL_H
+ #define SURGSIM_MATH_TRIANGLETRIANGLEINTERSECTION_INL_H
+ 
+-
+ namespace
+ {
+ static const double EPSILOND = 1e-12;
+@@ -79,6 +78,7 @@
+ 	const Eigen::Matrix<T, 3, 1, MOpt>& t1n)
+ {
+ 	typedef Eigen::Matrix<T, 3, 1, MOpt> Vector3;
++	using SurgSim::Math::Geometry::DistanceEpsilon;
+ 
+ 	if (t0n.isZero() || t1n.isZero())
+ 	{
+@@ -150,7 +150,9 @@
+ 			<< "The intersection between the triangle and the separating axis is not a line segment."
+ 			<< " This scenario cannot happen, at this point in the algorithm.";
+ 
+-	return !(s1[0] <= s2[0] && s1[0] <= s2[1] && s1[1] <= s2[0] && s1[1] <= s2[1]) &&
++	return !(std::abs(s1[0] - s2[0]) <= DistanceEpsilon && std::abs(s1[0] - s2[1]) <= DistanceEpsilon &&
++		     std::abs(s1[1] - s2[0]) <= DistanceEpsilon && std::abs(s1[1] - s2[1]) <= DistanceEpsilon) &&
++		   !(s1[0] <= s2[0] && s1[0] <= s2[1] && s1[1] <= s2[0] && s1[1] <= s2[1]) &&
+ 		   !(s1[0] >= s2[0] && s1[0] >= s2[1] && s1[1] >= s2[0] && s1[1] >= s2[1]);
+ }
+ 
diff --git a/debian/patches/fix-epsilon-for-tests.patch b/debian/patches/fix-epsilon-for-tests.patch
new file mode 100644
index 0000000..ec70aad
--- /dev/null
+++ b/debian/patches/fix-epsilon-for-tests.patch
@@ -0,0 +1,49 @@
+Description: Fixes failing tests due to floating point precision
+ On arm64, ppc64el, powerpc, and ppc64 the
+ GeometryTest.SegmentTriangleIntersection 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
+
+--- a/SurgSim/Math/Geometry.h
++++ b/SurgSim/Math/Geometry.h
+@@ -911,7 +911,7 @@
+ 	// Ray is parallel to triangle plane
+ 	if (std::abs(b) <= Geometry::AngularEpsilon)
+ 	{
+-		if (a == 0)
++		if (std::abs(a) <= Geometry::AngularEpsilon)
+ 		{
+ 			// Ray lies in triangle plane
+ 			Eigen::Matrix<T, 3, 1, MOpt> baryCoords;
+@@ -960,13 +960,13 @@
+ 	// Get and test parametric coords
+ 	T s = (uv * wv - vv * wu) / D;
+ 	// I is outside T
+-	if (s < 0 || s > 1)
++	if (s < -Geometry::DistanceEpsilon || s > 1 + Geometry::DistanceEpsilon)
+ 	{
+ 		return false;
+ 	}
+ 	T t = (uv * wu - uu * wv) / D;
+ 	// I is outside T
+-	if (t < 0 || (s + t) > 1)
++	if (t < -Geometry::DistanceEpsilon || (s + t) > 1 + Geometry::DistanceEpsilon)
+ 	{
+ 		return false;
+ 	}
+--- a/SurgSim/Physics/UnitTests/Fem3DElementTetrahedronTests.cpp
++++ b/SurgSim/Physics/UnitTests/Fem3DElementTetrahedronTests.cpp
+@@ -42,7 +42,7 @@
+ 	return inv6V * (ai[i] + bi[i] * p[0] + ci[i] * p[1] + di[i] * p[2]);
+ }
+ 
+-const double epsilon = 1e-9;
++const double epsilon = 1e-8;
+ };
+ 
+ class MockFem3DElementTet : public Fem3DElementTetrahedron
diff --git a/debian/patches/fix-timer.patch b/debian/patches/fix-timer.patch
index 7d98fe5..11634c8 100644
--- a/debian/patches/fix-timer.patch
+++ b/debian/patches/fix-timer.patch
@@ -2,7 +2,8 @@ Description: Fix Timer that caused test failures on mips, mipsel, and s390x
  std::accumulate was given an uninitialized value for its initial value. This
  explicitly sets it to zero.
 Author: Paul Novotny <paul at paulnovo.us>
-Last-Update: 2015-09-13
+Bug-Debian: https://bugs.debian.org/798718
+Last-Update: 2015-09-19
 
 --- a/SurgSim/Framework/Timer.cpp
 +++ b/SurgSim/Framework/Timer.cpp
diff --git a/debian/patches/series b/debian/patches/series
index 9ea7a91..6269cb2 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -6,3 +6,6 @@ backport-e762a2ea9.patch
 backport-d0a635981.patch
 dont-install-testing-libraries.patch
 fix-timer.patch
+backport-c7925c91f.patch
+backport-7b1d8836f.patch
+fix-epsilon-for-tests.patch

-- 
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