kopia lustrzana https://github.com/jaseg/gerbolyze
Fix scale of drill mapping test
rodzic
bc63166a40
commit
0d4172901b
Plik diff jest za duży
Load Diff
Przed Szerokość: | Wysokość: | Rozmiar: 182 KiB Po Szerokość: | Wysokość: | Rozmiar: 188 KiB |
|
@ -82,6 +82,6 @@ def test_convert_layers():
|
|||
assert set(round(ap.diameter, 4) for ap in stack[layer].apertures) == {dia, 0.05}
|
||||
|
||||
# Note: svg-flatten rounds these diameters to the geometric tolerance given on the command line (0.01mm by
|
||||
# default). Thus, these values are different from the more precise values in the SVG.
|
||||
assert set(stack.drill_layers[0].drill_sizes()) == {0.67, 0.51}
|
||||
# default).
|
||||
assert set(stack.drill_layers[0].drill_sizes()) == {0.7, 0.5}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue