Do not oversimplify outer perimeters and keep the full resolution of the input file. #340 #462

degen-loop-screen
Alessandro Ranellucci 2012-06-23 20:08:08 +02:00
parent 20229fccdb
commit 44c636aea1
3 changed files with 9 additions and 5 deletions

View File

@ -23,8 +23,8 @@ sub explode_expolygons {
}
sub safety_offset {
my ($polygons) = @_;
return Math::Clipper::offset($polygons, scale 1e-05, 100, JT_MITER, 2);
my ($polygons, $factor) = @_;
return Math::Clipper::offset($polygons, $factor || (scale 1e-05), 100, JT_MITER, 2);
}
sub diff_ex {

View File

@ -4,7 +4,7 @@ use Moo;
use Math::Clipper ':all';
use Slic3r::ExtrusionPath ':roles';
use Slic3r::Geometry qw(scale unscale collinear X Y A B PI rad2deg_dir bounding_box_center shortest_path);
use Slic3r::Geometry::Clipper qw(union_ex diff_ex intersection_ex xor_ex is_counter_clockwise);
use Slic3r::Geometry::Clipper qw(safety_offset union_ex diff_ex intersection_ex xor_ex is_counter_clockwise);
use Slic3r::Surface ':types';
# a sequential number of layer, starting at 0
@ -138,8 +138,7 @@ sub make_surfaces {
{
# merge everything
my $expolygons = union_ex($loops);
$_->simplify(scale $Slic3r::resolution) for @$expolygons;
my $expolygons = union_ex(safety_offset($loops, scale 0.1));
Slic3r::debugf " %d surface(s) having %d holes detected from %d polylines\n",
scalar(@$expolygons), scalar(map $_->holes, @$expolygons), scalar(@$loops);
@ -273,6 +272,7 @@ sub make_perimeters {
# create one more offset to be used as boundary for fill
{
my @fill_boundaries = map $_->offset_ex(-$distance), @last_offsets;
$_->simplify(scale $Slic3r::resolution) for @fill_boundaries;
push @{ $self->fill_boundaries }, @fill_boundaries;
# detect the small gaps that we need to treat like thin polygons,

View File

@ -221,6 +221,10 @@ sub export_gcode {
$status_cb->(20, "Generating perimeters");
$_->make_perimeters for @{$self->objects};
# simplify slices, we only need the max resolution for perimeters
$_->simplify(scale $Slic3r::resolution)
for map @{$_->expolygon}, map @{$_->slices}, map @{$_->layers}, @{$self->objects};
# this will clip $layer->surfaces to the infill boundaries
# and split them in top/bottom/internal surfaces;
$status_cb->(30, "Detecting solid surfaces");