aboutsummaryrefslogtreecommitdiff
path: root/svg-flatten
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2023-03-30 15:05:09 +0200
committerjaseg <git@jaseg.de>2023-03-30 15:05:09 +0200
commit0d4172901bb0f9a37c46cd46da786cf92155774c (patch)
treea328d2991934dec2e25c320fc4d2743878815662 /svg-flatten
parentbc63166a40f522014dfd11e830cce11d6d61be6d (diff)
downloadgerbolyze-0d4172901bb0f9a37c46cd46da786cf92155774c.tar.gz
gerbolyze-0d4172901bb0f9a37c46cd46da786cf92155774c.tar.bz2
gerbolyze-0d4172901bb0f9a37c46cd46da786cf92155774c.zip
Fix scale of drill mapping test
Diffstat (limited to 'svg-flatten')
-rw-r--r--svg-flatten/src/svg_doc.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/svg-flatten/src/svg_doc.cpp b/svg-flatten/src/svg_doc.cpp
index 77b561e..afb3a68 100644
--- a/svg-flatten/src/svg_doc.cpp
+++ b/svg-flatten/src/svg_doc.cpp
@@ -298,10 +298,12 @@ void gerbolyze::SVGDocument::export_svg_path(RenderContext &ctx, const pugi::xml
d2p centroid = nopencv::polygon_centroid(geom_poly);
centroid[0] /= clipper_scale;
centroid[1] /= clipper_scale;
+
/* area of n-gon with circumradius 1 relative to circle with radius 1 */
- double ngon_area_relative = p.size()/(2*std::numbers::pi) * sin(2*std::numbers::pi / p.size());
- double diameter = sqrt(4*fabs(area)/std::numbers::pi) / clipper_scale / ngon_area_relative;
- double tolerance = ctx.settings().geometric_tolerance_mm / 2;
+ //double ngon_area_relative = p.size()/(2*std::numbers::pi) * sin(2*std::numbers::pi / p.size());
+ // ^- correction not necessary, we already do a very good job.
+ double diameter = sqrt(4*fabs(area)/std::numbers::pi) / clipper_scale;
+ double tolerance = ctx.settings().geometric_tolerance_mm;
diameter = round(diameter/tolerance) * tolerance;
ctx.sink() << ApertureToken(diameter) << FlashToken(centroid);
}