summaryrefslogtreecommitdiff
path: root/DXF.pm
diff options
context:
space:
mode:
authorThomas Kremer <->2020-10-01 00:10:20 +0200
committerThomas Kremer <->2020-10-01 00:10:20 +0200
commitd27ec23b8c4f61095828d6581c2e5b22afde5d18 (patch)
treeeace2fcf79a35ec4cc2e6aabb893faf6c2074d25 /DXF.pm
parentae54e4ddcb16f0c63c03c6ae6aa8d1d02356e0c5 (diff)
rewritten combine_polylines to make up for slight errors in input files and made sort_polylines round everything to 1mm.
Diffstat (limited to 'DXF.pm')
-rw-r--r--DXF.pm4
1 files changed, 3 insertions, 1 deletions
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;
}