summaryrefslogtreecommitdiff
path: root/core/src/main/java
diff options
context:
space:
mode:
authormagethle <matthias.agethle@gmail.com>2025-02-10 17:22:04 +0300
committerGitHub <noreply@github.com>2025-02-10 17:22:04 +0300
commit2a779a95863caebe2e72459bc3752287c2a96ead (patch)
tree0e323695333ec96635153f21ab3a1cd1c14d2efa /core/src/main/java
parent6ae11863c7082cfeb62fa5075a488ec9588a01e6 (diff)
downloadzxing-2a779a95863caebe2e72459bc3752287c2a96ead.tar.xz
Comment on distortion calculation for isosceles right triangles (#1908)
* Fix distortion calculation for isosceles right triangles * Revert "Fix distortion calculation for isosceles right triangles" This reverts commit 4a8ad9a5bea9d0be251450f9e0db15b16e85e1ac. * Add comment to distortion calculation The formula for calculating the distortion seems wrong but practically it seems to work slightly better
Diffstat (limited to 'core/src/main/java')
-rwxr-xr-xcore/src/main/java/com/google/zxing/qrcode/detector/FinderPatternFinder.java2
1 files changed, 2 insertions, 0 deletions
diff --git a/core/src/main/java/com/google/zxing/qrcode/detector/FinderPatternFinder.java b/core/src/main/java/com/google/zxing/qrcode/detector/FinderPatternFinder.java
index 17ca88b8f..951bd197f 100755
--- a/core/src/main/java/com/google/zxing/qrcode/detector/FinderPatternFinder.java
+++ b/core/src/main/java/com/google/zxing/qrcode/detector/FinderPatternFinder.java
@@ -695,6 +695,8 @@ public class FinderPatternFinder {
// we need to check both two equal sides separately.
// The value of |c^2 - 2 * b^2| + |c^2 - 2 * a^2| increases as dissimilarity
// from isosceles right triangle.
+ // Heuristically it seems that the following formula works better (although it's
+ // not clear any more why...)
double d = Math.abs(c - 2 * b) + Math.abs(c - 2 * a);
if (d < distortion) {
distortion = d;