Comment on distortion calculation for isosceles right triangles (#1908)
Some checks failed
CodeQL / Analyze (java) (push) Has been cancelled
Test Java 17 / build (push) Has been cancelled
Test Java 21 / build (push) Has been cancelled
Test Java 8 / build (push) Has been cancelled

* Fix distortion calculation for isosceles right triangles

* Revert "Fix distortion calculation for isosceles right triangles"

This reverts commit 4a8ad9a5be.

* Add comment to distortion calculation

The formula for calculating the distortion seems wrong but practically it seems to work slightly better
This commit is contained in:
magethle 2025-02-10 15:22:04 +01:00 committed by GitHub
parent 6ae11863c7
commit 2a779a9586
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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;