Make sure brim paths don't overlap
This commit is contained in:
parent
4aad2f6243
commit
5bf3f5f5e4
2 changed files with 14 additions and 3 deletions
|
@ -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 union_pt);
|
||||
JT_SQUARE is_counter_clockwise union_pt ex_int_offset2 offset2);
|
||||
|
||||
use Math::Clipper 1.17 qw(:cliptypes :polyfilltypes :jointypes is_counter_clockwise area);
|
||||
use Slic3r::Geometry qw(scale);
|
||||
|
@ -33,6 +33,16 @@ sub offset {
|
|||
return @$offsets;
|
||||
}
|
||||
|
||||
sub offset2 {
|
||||
my ($polygons, $distance1, $distance2, $scale, $joinType, $miterLimit) = @_;
|
||||
$scale ||= 100000;
|
||||
$joinType //= JT_MITER;
|
||||
$miterLimit //= 3;
|
||||
|
||||
my $offsets = Math::Clipper::int_offset2($polygons, $distance1, $distance2, $scale, $joinType, $miterLimit);
|
||||
return @$offsets;
|
||||
}
|
||||
|
||||
sub offset_ex {
|
||||
my ($polygons, $distance, $scale, $joinType, $miterLimit) = @_;
|
||||
$scale ||= 100000;
|
||||
|
|
|
@ -7,7 +7,8 @@ use List::Util qw(max first);
|
|||
use Math::ConvexHull::MonotoneChain qw(convex_hull);
|
||||
use Slic3r::ExtrusionPath ':roles';
|
||||
use Slic3r::Geometry qw(X Y Z X1 Y1 X2 Y2 MIN PI scale unscale move_points nearest_point chained_path_items);
|
||||
use Slic3r::Geometry::Clipper qw(diff_ex union_ex union_pt intersection_ex offset JT_ROUND JT_SQUARE PFT_EVENODD);
|
||||
use Slic3r::Geometry::Clipper qw(diff_ex union_ex union_pt intersection_ex offset
|
||||
ex_int_offset2 offset2 JT_ROUND JT_SQUARE PFT_EVENODD);
|
||||
use Time::HiRes qw(gettimeofday tv_interval);
|
||||
|
||||
has 'config' => (is => 'rw', default => sub { Slic3r::Config->new_from_defaults }, trigger => 1);
|
||||
|
@ -679,7 +680,7 @@ sub make_brim {
|
|||
# JT_SQUARE ensures no vertex is outside the given offset distance
|
||||
# -0.5 because islands are not represented by their centerlines
|
||||
# TODO: we need the offset inwards/offset outwards logic to avoid overlapping extrusions
|
||||
push @loops, offset(\@islands, ($i - 0.5) * $flow->scaled_spacing, undef, JT_SQUARE);
|
||||
push @loops, offset2(\@islands, ($i - 2) * $flow->scaled_spacing, ($i + 1.5) * $flow->scaled_spacing, undef, JT_SQUARE);
|
||||
}
|
||||
|
||||
# prepare a subroutine to traverse the tree and return inner perimeters first
|
||||
|
|
Loading…
Reference in a new issue