Fix regression in start perimeters at non-overhangs. #1442
This commit is contained in:
parent
9a51964e98
commit
a88ce0cb5e
@ -29,18 +29,18 @@ sub clip_with_expolygon {
|
|||||||
|
|
||||||
sub intersect_expolygons {
|
sub intersect_expolygons {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my ($expolygons) = @_;
|
my ($expolygons_pp) = @_;
|
||||||
|
|
||||||
return map $self->clone(polyline => Slic3r::Polyline->new(@$_)),
|
return map $self->clone(polyline => Slic3r::Polyline->new(@$_)),
|
||||||
@{Boost::Geometry::Utils::multi_polygon_multi_linestring_intersection([ map $_->pp, @$expolygons ], [$self->pp])};
|
@{Boost::Geometry::Utils::multi_polygon_multi_linestring_intersection($expolygons_pp, [$self->pp])};
|
||||||
}
|
}
|
||||||
|
|
||||||
sub subtract_expolygons {
|
sub subtract_expolygons {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my ($expolygons) = @_;
|
my ($expolygons_pp) = @_;
|
||||||
|
|
||||||
return map $self->clone(polyline => Slic3r::Polyline->new(@$_)),
|
return map $self->clone(polyline => Slic3r::Polyline->new(@$_)),
|
||||||
@{Boost::Geometry::Utils::multi_linestring_multi_polygon_difference([$self->pp], [ map $_->pp, @$expolygons ])};
|
@{Boost::Geometry::Utils::multi_linestring_multi_polygon_difference([$self->pp], $expolygons_pp)};
|
||||||
}
|
}
|
||||||
|
|
||||||
sub simplify {
|
sub simplify {
|
||||||
|
@ -16,7 +16,7 @@ has 'layer_count' => (is => 'ro', required => 1 );
|
|||||||
has 'layer' => (is => 'rw');
|
has 'layer' => (is => 'rw');
|
||||||
has '_layer_islands' => (is => 'rw');
|
has '_layer_islands' => (is => 'rw');
|
||||||
has '_upper_layer_islands' => (is => 'rw');
|
has '_upper_layer_islands' => (is => 'rw');
|
||||||
has '_layer_overhangs' => (is => 'rw');
|
has '_layer_overhangs_pp' => (is => 'rw');
|
||||||
has 'shift_x' => (is => 'rw', default => sub {0} );
|
has 'shift_x' => (is => 'rw', default => sub {0} );
|
||||||
has 'shift_y' => (is => 'rw', default => sub {0} );
|
has 'shift_y' => (is => 'rw', default => sub {0} );
|
||||||
has 'z' => (is => 'rw');
|
has 'z' => (is => 'rw');
|
||||||
@ -99,10 +99,10 @@ sub change_layer {
|
|||||||
$self->_layer_islands([]);
|
$self->_layer_islands([]);
|
||||||
$self->_upper_layer_islands([]);
|
$self->_upper_layer_islands([]);
|
||||||
}
|
}
|
||||||
$self->_layer_overhangs(
|
$self->_layer_overhangs_pp(
|
||||||
# clone ExPolygons because they come from Surface objects but will be used outside here
|
# clone ExPolygons because they come from Surface objects but will be used outside here
|
||||||
$layer->id > 0 && ($layer->config->overhangs || $Slic3r::Config->start_perimeters_at_non_overhang)
|
($layer->id > 0 && ($layer->config->overhangs || $Slic3r::Config->start_perimeters_at_non_overhang))
|
||||||
? [ map $_->expolygon->clone, grep $_->surface_type == S_TYPE_BOTTOM, map @{$_->slices}, @{$layer->regions} ]
|
? [ map $_->expolygon->pp, grep $_->surface_type == S_TYPE_BOTTOM, map @{$_->slices}, @{$layer->regions} ]
|
||||||
: []
|
: []
|
||||||
);
|
);
|
||||||
if ($self->config->avoid_crossing_perimeters) {
|
if ($self->config->avoid_crossing_perimeters) {
|
||||||
@ -180,7 +180,7 @@ sub extrude_loop {
|
|||||||
}
|
}
|
||||||
my @candidates = ();
|
my @candidates = ();
|
||||||
if ($Slic3r::Config->start_perimeters_at_non_overhang) {
|
if ($Slic3r::Config->start_perimeters_at_non_overhang) {
|
||||||
@candidates = grep !Boost::Geometry::Utils::point_covered_by_multi_polygon($_->pp, $self->_layer_overhangs), @concave;
|
@candidates = grep !Boost::Geometry::Utils::point_covered_by_multi_polygon($_->pp, $self->_layer_overhangs_pp), @concave;
|
||||||
}
|
}
|
||||||
if (!@candidates) {
|
if (!@candidates) {
|
||||||
# if none, look for any concave vertex
|
# if none, look for any concave vertex
|
||||||
@ -188,7 +188,7 @@ sub extrude_loop {
|
|||||||
if (!@candidates) {
|
if (!@candidates) {
|
||||||
# if none, look for any non-overhang vertex
|
# if none, look for any non-overhang vertex
|
||||||
if ($Slic3r::Config->start_perimeters_at_non_overhang) {
|
if ($Slic3r::Config->start_perimeters_at_non_overhang) {
|
||||||
@candidates = grep !Boost::Geometry::Utils::point_covered_by_multi_polygon($_->pp, $self->_layer_overhangs), @{$polygon};
|
@candidates = grep !Boost::Geometry::Utils::point_covered_by_multi_polygon($_->pp, $self->_layer_overhangs_pp), @$polygon;
|
||||||
}
|
}
|
||||||
if (!@candidates) {
|
if (!@candidates) {
|
||||||
# if none, all points are valid candidates
|
# if none, all points are valid candidates
|
||||||
@ -218,15 +218,15 @@ sub extrude_loop {
|
|||||||
|
|
||||||
my @paths = ();
|
my @paths = ();
|
||||||
# detect overhanging/bridging perimeters
|
# detect overhanging/bridging perimeters
|
||||||
if ($self->layer->config->overhangs && $extrusion_path->is_perimeter && @{$self->_layer_overhangs}) {
|
if ($self->layer->config->overhangs && $extrusion_path->is_perimeter && @{$self->_layer_overhangs_pp}) {
|
||||||
# get non-overhang paths by subtracting overhangs from the loop
|
# get non-overhang paths by subtracting overhangs from the loop
|
||||||
push @paths,
|
push @paths,
|
||||||
$extrusion_path->subtract_expolygons($self->_layer_overhangs);
|
$extrusion_path->subtract_expolygons($self->_layer_overhangs_pp);
|
||||||
|
|
||||||
# get overhang paths by intersecting overhangs with the loop
|
# get overhang paths by intersecting overhangs with the loop
|
||||||
push @paths,
|
push @paths,
|
||||||
map { $_->role(EXTR_ROLE_OVERHANG_PERIMETER); $_ }
|
map { $_->role(EXTR_ROLE_OVERHANG_PERIMETER); $_ }
|
||||||
$extrusion_path->intersect_expolygons($self->_layer_overhangs);
|
$extrusion_path->intersect_expolygons($self->_layer_overhangs_pp);
|
||||||
|
|
||||||
# reapply the nearest point search for starting point
|
# reapply the nearest point search for starting point
|
||||||
# (clone because the collection gets DESTROY'ed)
|
# (clone because the collection gets DESTROY'ed)
|
||||||
|
@ -69,9 +69,10 @@ sub subdivide {
|
|||||||
sub concave_points {
|
sub concave_points {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
|
|
||||||
my @points = @{$self->pp};
|
my @points = @$self;
|
||||||
return map $self->[$_],
|
my @points_pp = @{$self->pp};
|
||||||
grep Slic3r::Geometry::angle3points(@points[$_, $_-1, $_+1]) < PI - epsilon,
|
return map $points[$_],
|
||||||
|
grep Slic3r::Geometry::angle3points(@points_pp[$_, $_-1, $_+1]) < PI - epsilon,
|
||||||
-1 .. ($#points-1);
|
-1 .. ($#points-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user