From 508810ede678db901a9ec84020781d07c0eb30eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Ma=C5=9Blanka?= Date: Fri, 28 May 2021 20:07:08 +0200 Subject: [PATCH] utilized fabs to fix the bug --- opensfm/src/geometry/triangulation.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/opensfm/src/geometry/triangulation.h b/opensfm/src/geometry/triangulation.h index fa4cf3632..06c3a0a2b 100644 --- a/opensfm/src/geometry/triangulation.h +++ b/opensfm/src/geometry/triangulation.h @@ -7,6 +7,7 @@ #include #include #include +#include double AngleBetweenVectors(const Eigen::Vector3d &u, const Eigen::Vector3d &v); @@ -68,7 +69,7 @@ std::pair> TriangulateTwoBearingsMidpointSolve( const T eps = T(1e-30); const T det = A.determinant(); - if ((det < eps) && (det > -eps)) { + if (fabs(det) < eps) { return std::make_pair(false, Eigen::Matrix()); } const auto lambdas = A.inverse() * b;