From dc37cbadba8f2ee3ecb6889984465c0d2bbcacef Mon Sep 17 00:00:00 2001 From: srowen Date: Thu, 17 Jan 2013 19:52:40 +0000 Subject: [PATCH] Issue 1437 use fabs() git-svn-id: https://zxing.googlecode.com/svn/trunk@2556 59b500cc-1b3d-0410-9834-0bbf25fbcc57 --- .../multi/qrcode/detector/MultiFinderPatternFinder.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cpp/core/src/zxing/multi/qrcode/detector/MultiFinderPatternFinder.cpp b/cpp/core/src/zxing/multi/qrcode/detector/MultiFinderPatternFinder.cpp index c9a9cbb88..6ebeb3696 100644 --- a/cpp/core/src/zxing/multi/qrcode/detector/MultiFinderPatternFinder.cpp +++ b/cpp/core/src/zxing/multi/qrcode/detector/MultiFinderPatternFinder.cpp @@ -171,7 +171,7 @@ std::vector > > MultiFinderPatternFinder::selectB Ref p2 = possibleCenters[i2]; // Compare the expected module sizes; if they are really off, skip float vModSize12 = (p1->getEstimatedModuleSize() - p2->getEstimatedModuleSize()) / std::min(p1->getEstimatedModuleSize(), p2->getEstimatedModuleSize()); - float vModSize12A = abs(p1->getEstimatedModuleSize() - p2->getEstimatedModuleSize()); + float vModSize12A = fabs(p1->getEstimatedModuleSize() - p2->getEstimatedModuleSize()); if (vModSize12A > DIFF_MODSIZE_CUTOFF && vModSize12 >= DIFF_MODSIZE_CUTOFF_PERCENT) { // break, since elements are ordered by the module size deviation there cannot be // any more interesting elements for the given p1. @@ -181,7 +181,7 @@ std::vector > > MultiFinderPatternFinder::selectB Ref p3 = possibleCenters[i3]; // Compare the expected module sizes; if they are really off, skip float vModSize23 = (p2->getEstimatedModuleSize() - p3->getEstimatedModuleSize()) / std::min(p2->getEstimatedModuleSize(), p3->getEstimatedModuleSize()); - float vModSize23A = abs(p2->getEstimatedModuleSize() - p3->getEstimatedModuleSize()); + float vModSize23A = fabs(p2->getEstimatedModuleSize() - p3->getEstimatedModuleSize()); if (vModSize23A > DIFF_MODSIZE_CUTOFF && vModSize23 >= DIFF_MODSIZE_CUTOFF_PERCENT) { // break, since elements are ordered by the module size deviation there cannot be // any more interesting elements for the given p1. @@ -203,14 +203,14 @@ std::vector > > MultiFinderPatternFinder::selectB continue; } // Calculate the difference of the edge lengths in percent - float vABBC = abs((dA - dB) / std::min(dA, dB)); + float vABBC = fabs((dA - dB) / std::min(dA, dB)); if (vABBC >= 0.1f) { continue; } // Calculate the diagonal length by assuming a 90° angle at topleft float dCpy = (float) sqrt(dA * dA + dB * dB); // Compare to the real distance in % - float vPyC = abs((dC - dCpy) / std::min(dC, dCpy)); + float vPyC = fabs((dC - dCpy) / std::min(dC, dCpy)); if (vPyC >= 0.1f) { continue; }