Remove old code

This commit is contained in:
Alessandro Ranellucci 2011-09-25 19:51:03 +02:00
parent 18c7aef1a7
commit f48dec9e41

View File

@ -146,39 +146,6 @@ sub offset_polygon {
outer => $_,
holes => [ @hole_offsets ],
}} @contour_offsets;
# OLD CODE to be removed
if (0) {
#my $contour_offsets = $contour_p->offset_polygon($Slic3r::flow_width / $Slic3r::resolution);
#my @hole_offsets = map @$_, map $_->offset_polygon(- $Slic3r::flow_width / $Slic3r::resolution), @holes_p;
Slic3r::SVG::output_polygons($main::print, "holes.svg", [ @holes_p ]);
my $contour_offsets = offset([ $contour_p ], -$distance);
my @hole_offsets = map { ref $_ eq 'ARRAY' ? @$_ : () } map offset([ $_ ], -$distance), @holes_p;
# defensive programming
if (@$contour_offsets > 1) {
die "Got more than one contour offset!";
}
# now we subtract perimeter offsets from the contour offset polygon
# this will generate a single polygon with correct holes and also
# will take care of collisions between contour offset and holes
my $clipper = Math::Clipper->new;
my @resulting_offsets = ();
foreach my $contour_points (@$contour_offsets) {
$clipper->clear;
$clipper->add_subject_polygon($contour_points);
$clipper->add_clip_polygon($_) for @hole_offsets;
my $result = $clipper->ex_execute(CT_DIFFERENCE, PFT_NONZERO, PFT_NONZERO);
# now we've got @$result, which is an array of Math::Clipper ExPolygons
# representing the inner surface including hole perimeters
push @resulting_offsets, @$result;
}
return @resulting_offsets;
}
}
sub _mgp_from_points_ref {