From 71b04a6ec2ce35a080ec74313f07eea248291fc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= Date: Fri, 28 May 2021 18:05:12 +0200 Subject: [PATCH] Fix behaviour on PPC64EL Double, while calculating abs(det) is promoted to int on ppc64el, so that the modified condition always held. Since abs from cmath also returns wrong result, I've fixed it as follows. --- opensfm/src/geometry/triangulation.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opensfm/src/geometry/triangulation.h b/opensfm/src/geometry/triangulation.h index 013ad4c2a..fa4cf3632 100644 --- a/opensfm/src/geometry/triangulation.h +++ b/opensfm/src/geometry/triangulation.h @@ -68,7 +68,7 @@ std::pair> TriangulateTwoBearingsMidpointSolve( const T eps = T(1e-30); const T det = A.determinant(); - if (abs(det) < eps) { + if ((det < eps) && (det > -eps)) { return std::make_pair(false, Eigen::Matrix()); } const auto lambdas = A.inverse() * b;