Hi,

Admittedly, this is a rather heavy-handed approach, but changing epsilon
for the Collinear() calls to 1e-3 instead of 1e-4 lets the builds complete
successfully on all architectures, including i386.

This appears to be as being related to
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=323 , in other words, because
the CrossProduct as it is being calculated is probably having values
rounded multiple times.

Attached is a patch that has been applied on Ubuntu to change the epsilon
value used for the Line2 tests.

I think this warrants being brought up to the upstream too, perhaps they
have a preferred way of dealing with this.

Kindly,

Mathieu Trudel-Lapierre <mathieu...@ubuntu.com>
Freenode: cyphermox, Jabber: mathieu...@gmail.com
4096R/EE018C93 1967 8F7D 03A1 8F38 732E  FF82 C126 33E1 EE01 8C93
From: Mathieu Trudel-Lapierre <mathieu.trudel-lapie...@canonical.com>
Subject: Allow for a bit more rounding when verifying collinearity

---
 src/Line2_TEST.cc |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: b/src/Line2_TEST.cc
===================================================================
--- a/src/Line2_TEST.cc
+++ b/src/Line2_TEST.cc
@@ -147,7 +147,7 @@ TEST(Line2Test, CollinearPoint)
 
   pt.Set(0, 0.00001);
   EXPECT_FALSE(lineA.Collinear(pt));
-  EXPECT_TRUE(lineA.Collinear(pt, 1e-4));
+  EXPECT_TRUE(lineA.Collinear(pt, 1e-3));
   {
     math::Line2d ptLine(pt, pt);
     EXPECT_FALSE(lineA.Collinear(ptLine));
@@ -159,7 +159,7 @@ TEST(Line2Test, CollinearPoint)
 
   pt.Set(0, -0.00001);
   EXPECT_FALSE(lineA.Collinear(pt));
-  EXPECT_TRUE(lineA.Collinear(pt, 1e-4));
+  EXPECT_TRUE(lineA.Collinear(pt, 1e-3));
   {
     math::Line2d ptLine(pt, pt);
     EXPECT_FALSE(lineA.Collinear(ptLine));

Reply via email to