Improvements to avoid numerical issues in bridge detection and bridge exclusion
This commit is contained in:
parent
581376bf75
commit
010b71e9d4
@ -243,7 +243,7 @@ sub unsupported_edges {
|
|||||||
|
|
||||||
# filter out edges parallel to the bridging angle
|
# filter out edges parallel to the bridging angle
|
||||||
for (my $i = 0; $i <= $#$unsupported; ++$i) {
|
for (my $i = 0; $i <= $#$unsupported; ++$i) {
|
||||||
if (first { abs($_->direction - $angle) < epsilon } @{$unsupported->[$i]->lines}) {
|
if ($unsupported->[$i]->is_straight && abs($unsupported->[$i]->lines->[0]->direction < $angle) < epsilon) {
|
||||||
splice @$unsupported, $i, 1;
|
splice @$unsupported, $i, 1;
|
||||||
--$i;
|
--$i;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package Slic3r::Polyline;
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
|
use List::Util qw(first);
|
||||||
use Slic3r::Geometry qw(X Y epsilon);
|
use Slic3r::Geometry qw(X Y epsilon);
|
||||||
use Slic3r::Geometry::Clipper qw(JT_SQUARE);
|
use Slic3r::Geometry::Clipper qw(JT_SQUARE);
|
||||||
|
|
||||||
@ -29,18 +30,11 @@ sub size {
|
|||||||
sub is_straight {
|
sub is_straight {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
my $last_dir;
|
# Check that each segment's direction is equal to the line connecting
|
||||||
foreach my $line (@{$self->lines}) {
|
# first point and last point. (Checking each line against the previous
|
||||||
my $dir = $line->direction;
|
# one would have caused the error to accumulate.)
|
||||||
if (defined $last_dir) {
|
my $dir = Slic3r::Line->new($self->first_point, $self->last_point)->direction;
|
||||||
if (abs($dir - $last_dir) > epsilon) {
|
return !defined first { abs($_->direction - $dir) > epsilon } @{$self->lines};
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$last_dir = $dir;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
@ -165,6 +165,8 @@ sub contact_area {
|
|||||||
|
|
||||||
my $bridged_perimeters; # Polygons
|
my $bridged_perimeters; # Polygons
|
||||||
{
|
{
|
||||||
|
my $bridge_flow = $layerm->flow(FLOW_ROLE_PERIMETER, 1);
|
||||||
|
|
||||||
my $nozzle_diameter = $self->print_config->get_at('nozzle_diameter', $layerm->region->config->perimeter_extruder-1);
|
my $nozzle_diameter = $self->print_config->get_at('nozzle_diameter', $layerm->region->config->perimeter_extruder-1);
|
||||||
my $lower_grown_slices = offset([ map @$_, @{$lower_layer->slices} ], +scale($nozzle_diameter/2));
|
my $lower_grown_slices = offset([ map @$_, @{$lower_layer->slices} ], +scale($nozzle_diameter/2));
|
||||||
|
|
||||||
@ -192,9 +194,16 @@ sub contact_area {
|
|||||||
$layer->slices->contains_point($_->first_point) && $layer->slices->contains_point($_->last_point)
|
$layer->slices->contains_point($_->first_point) && $layer->slices->contains_point($_->last_point)
|
||||||
} @overhang_perimeters;
|
} @overhang_perimeters;
|
||||||
|
|
||||||
$bridged_perimeters = union([
|
# convert bridging polylines into polygons by inflating them with their thickness
|
||||||
map @{$_->grow($fw/2)}, @overhang_perimeters
|
{
|
||||||
]);
|
# since we're dealing with bridges, we can't assume width is larger than spacing,
|
||||||
|
# so we take the largest value and also apply safety offset to be ensure no gaps
|
||||||
|
# are left in between
|
||||||
|
my $w = max($bridge_flow->scaled_width, $bridge_flow->scaled_spacing);
|
||||||
|
$bridged_perimeters = union([
|
||||||
|
map @{$_->grow($w/2 + 10)}, @overhang_perimeters
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (1) {
|
if (1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user