Skip to content

Commit

Permalink
Fix behaviour on PPC64EL
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Piotr Maślanka authored May 28, 2021
1 parent b5cf3b0 commit 71b04a6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion opensfm/src/geometry/triangulation.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ std::pair<bool, Eigen::Matrix<T, 3, 1>> 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<T, 3, 1>());
}
const auto lambdas = A.inverse() * b;
Expand Down

0 comments on commit 71b04a6

Please sign in to comment.