Merge branch 'master' into grow-narrow

This commit is contained in:
Alessandro Ranellucci 2013-03-16 20:09:11 +01:00
commit 38b79c6bf7
18 changed files with 152 additions and 66 deletions

View file

@ -4,7 +4,7 @@ use warnings;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(safety_offset offset offset_ex
our @EXPORT_OK = qw(safety_offset offset offset_ex collapse_ex
diff_ex diff union_ex intersection_ex xor_ex PFT_EVENODD JT_MITER JT_ROUND
JT_SQUARE is_counter_clockwise);
@ -91,4 +91,23 @@ sub xor_ex {
];
}
sub collapse_ex {
my ($polygons, $width) = @_;
my @result = offset(
[ offset($polygons, -$width/2,) ],
+$width/2,
);
return union_ex([@result]);
}
sub simplify_polygon {
my ($polygon, $pft) = @_;
return @{ Math::Clipper::simplify_polygon($polygon, $pft // PFT_NONZERO) };
}
sub simplify_polygons {
my ($polygons, $pft) = @_;
return @{ Math::Clipper::simplify_polygons($polygons, $pft // PFT_NONZERO) };
}
1;