From d27ec23b8c4f61095828d6581c2e5b22afde5d18 Mon Sep 17 00:00:00 2001 From: Thomas Kremer <-> Date: Thu, 1 Oct 2020 00:10:20 +0200 Subject: rewritten combine_polylines to make up for slight errors in input files and made sort_polylines round everything to 1mm. --- DXF.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'DXF.pm') diff --git a/DXF.pm b/DXF.pm index 2e4bd1a..68ffc2a 100644 --- a/DXF.pm +++ b/DXF.pm @@ -845,7 +845,7 @@ my %replacers = ( my $fn = 20; while (@sx >= 4) { # TODO: subdivide by angle first. Estimate curvature. - for my $i (1..$fn) { + for my $i (1..$fn-1) { my $t = $i/$fn; my $x1 = $sx[0]*(1-$t)**3 + 3*$sx[1]*(1-$t)**2*$t + 3*$sx[2]*(1-$t)*$t**2 + $sx[3]*$t**3; @@ -856,6 +856,8 @@ my %replacers = ( #push @coords,$x1,$y1; #@p = ($x1,$y1); } + push @x, $sx[3]; # want to avoid any rounding errors + push @y, $sy[3]; splice @sx,0,3; splice @sy,0,3; } -- cgit v1.2.3