aboutsummaryrefslogtreecommitdiff
path: root/svg-flatten/include
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2024-09-23 22:44:31 +0200
committerjaseg <git@jaseg.de>2024-09-23 22:44:31 +0200
commitd6ca9cdf71f3c4f06797fb5459127cfe1cd55e9d (patch)
treebd7a47736a96860ed3d71f5a0e8dcaddf0f83c39 /svg-flatten/include
parent00f0d772f7e1009324998ca6d739df4275c98d6a (diff)
downloadgerbolyze-d6ca9cdf71f3c4f06797fb5459127cfe1cd55e9d.tar.gz
gerbolyze-d6ca9cdf71f3c4f06797fb5459127cfe1cd55e9d.tar.bz2
gerbolyze-d6ca9cdf71f3c4f06797fb5459127cfe1cd55e9d.zip
svg-flatten: Fix uniformity calculation
Previously, the uniformity check miscalculated the worst-case absolute deviation
Diffstat (limited to 'svg-flatten/include')
-rw-r--r--svg-flatten/include/geom2d.hpp5
1 files changed, 3 insertions, 2 deletions
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) {