From d6ca9cdf71f3c4f06797fb5459127cfe1cd55e9d Mon Sep 17 00:00:00 2001 From: jaseg Date: Mon, 23 Sep 2024 22:44:31 +0200 Subject: svg-flatten: Fix uniformity calculation Previously, the uniformity check miscalculated the worst-case absolute deviation --- svg-flatten/include/geom2d.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'svg-flatten/include') diff --git a/svg-flatten/include/geom2d.hpp b/svg-flatten/include/geom2d.hpp index 34455cd..28ce024 100644 --- a/svg-flatten/include/geom2d.hpp +++ b/svg-flatten/include/geom2d.hpp @@ -180,10 +180,11 @@ namespace gerbolyze { } double imbalance = f_max / f_min - 1.0; - //cerr << " * skew check: " << dbg_str(); + bool okay = imbalance < rel_tol && (f_max - f_min)*fabs(dist_doc) < abs_tol; + //cerr << " " << (okay ? "." : "#") << " skew check: " << dbg_str(); //cerr << " imbalance=" << imbalance << endl; //cerr << " rel=" << (imbalance < rel_tol) << " abs=" << (imbalance*fabs(dist_doc) < abs_tol) << endl; - return imbalance < rel_tol && imbalance*fabs(dist_doc) < abs_tol; + return okay; } double doc2phys_min(double dist_doc) { -- cgit