Smarter ordering of brim loops. #687

This commit is contained in:
Alessandro Ranellucci 2013-05-09 14:52:56 +02:00
parent 855ba90332
commit 4aad2f6243
2 changed files with 39 additions and 8 deletions

View file

@ -6,7 +6,7 @@ require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(safety_offset safety_offset_ex 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);
JT_SQUARE is_counter_clockwise union_pt);
use Math::Clipper 1.17 qw(:cliptypes :polyfilltypes :jointypes is_counter_clockwise area);
use Slic3r::Geometry qw(scale);
@ -78,6 +78,14 @@ sub union_ex {
];
}
sub union_pt {
my ($polygons, $jointype, $safety_offset) = @_;
$jointype = PFT_NONZERO unless defined $jointype;
$clipper->clear;
$clipper->add_subject_polygons($safety_offset ? safety_offset($polygons) : $polygons);
return $clipper->pt_execute(CT_UNION, $jointype, $jointype);
}
sub intersection_ex {
my ($subject, $clip, $jointype, $safety_offset) = @_;
$jointype = PFT_NONZERO unless defined $jointype;