mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-06 05:24:01 -06:00
Update Clipper to 6.0.0
This commit is contained in:
parent
d49052779f
commit
50c0081d25
16 changed files with 2941 additions and 1816 deletions
|
@ -293,6 +293,7 @@ sub make_perimeters {
|
|||
my @p = map $_->medial_axis($pspacing), @thin_walls;
|
||||
my @paths = ();
|
||||
for my $p (@p) {
|
||||
next if $p->length <= $pspacing * 2;
|
||||
my %params = (
|
||||
role => EXTR_ROLE_EXTERNAL_PERIMETER,
|
||||
flow_spacing => $self->perimeter_flow->spacing,
|
||||
|
|
|
@ -31,7 +31,7 @@ sub point_on_left {
|
|||
|
||||
sub grow {
|
||||
my $self = shift;
|
||||
return Slic3r::Polyline->new(@$self[0,1,0])->grow(@_);
|
||||
return Slic3r::Polyline->new(@$self)->grow(@_);
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -35,20 +35,6 @@ sub simplify {
|
|||
return __PACKAGE__->new(@$simplified);
|
||||
}
|
||||
|
||||
sub grow {
|
||||
my $self = shift;
|
||||
my ($distance, $scale, $joinType, $miterLimit) = @_;
|
||||
$joinType //= JT_SQUARE; # we override this one
|
||||
$scale //= 100000; # we init these because we can't pass undef
|
||||
$miterLimit //= 3;
|
||||
|
||||
my @points = @$self;
|
||||
return @{Slic3r::Geometry::Clipper::offset(
|
||||
[ Slic3r::Polygon->new(@points, CORE::reverse @points[1..($#points-1)]) ],
|
||||
$distance, $scale, $joinType, $miterLimit,
|
||||
)};
|
||||
}
|
||||
|
||||
sub clip_with_polygon {
|
||||
my $self = shift;
|
||||
my ($polygon) = @_;
|
||||
|
|
|
@ -652,10 +652,10 @@ sub make_brim {
|
|||
if (@{ $object->support_layers }) {
|
||||
my $support_layer0 = $object->support_layers->[0];
|
||||
push @object_islands,
|
||||
(map $_->polyline->grow($grow_distance), @{$support_layer0->support_fills})
|
||||
(map @{$_->polyline->grow($grow_distance)}, @{$support_layer0->support_fills})
|
||||
if $support_layer0->support_fills;
|
||||
push @object_islands,
|
||||
(map $_->polyline->grow($grow_distance), @{$support_layer0->support_interface_fills})
|
||||
(map @{$_->polyline->grow($grow_distance)}, @{$support_layer0->support_interface_fills})
|
||||
if $support_layer0->support_interface_fills;
|
||||
}
|
||||
foreach my $copy (@{$object->copies}) {
|
||||
|
@ -666,7 +666,7 @@ sub make_brim {
|
|||
# if brim touches skirt, make it around skirt too
|
||||
# TODO: calculate actual skirt width (using each extruder's flow in multi-extruder setups)
|
||||
if ($Slic3r::Config->skirt_distance + (($Slic3r::Config->skirts - 1) * $flow->spacing) <= $Slic3r::Config->brim_width) {
|
||||
push @islands, map $_->split_at_first_point->polyline->grow($grow_distance), @{$self->skirt};
|
||||
push @islands, map @{$_->split_at_first_point->polyline->grow($grow_distance)}, @{$self->skirt};
|
||||
}
|
||||
|
||||
my @loops = ();
|
||||
|
|
|
@ -258,6 +258,10 @@ sub make_perimeters {
|
|||
|
||||
# only add the perimeter if there's an intersection with the collapsed area
|
||||
last CYCLE if !@{ intersection($diff, $hypothetical_perimeter) };
|
||||
use Slic3r::SVG;
|
||||
Slic3r::SVG::output("extra.svg",
|
||||
expolygons => union_ex(intersection($diff, $hypothetical_perimeter)),
|
||||
);exit;
|
||||
Slic3r::debugf " adding one more perimeter at layer %d\n", $layer_id;
|
||||
$slice->extra_perimeters($extra_perimeters);
|
||||
}
|
||||
|
|
|
@ -480,7 +480,7 @@ sub generate_toolpaths {
|
|||
# solution should be found to achieve both goals
|
||||
$contact_infill = diff(
|
||||
$contact,
|
||||
[ map $_->grow($circle_radius*1.1), @loops ],
|
||||
[ map @{$_->grow($circle_radius*1.1)}, @loops ],
|
||||
);
|
||||
|
||||
# transform loops into ExtrusionPath objects
|
||||
|
|
|
@ -92,7 +92,7 @@ sub _plot {
|
|||
foreach my $path (@paths) {
|
||||
foreach my $line (@{$path->lines}) {
|
||||
my @intersections = @{ Boost::Geometry::Utils::polygon_multi_linestring_intersection(
|
||||
Slic3r::ExPolygon->new($line->grow(Slic3r::Geometry::scale $path->flow_spacing/2))->pp,
|
||||
Slic3r::ExPolygon->new(@{$line->grow(Slic3r::Geometry::scale $path->flow_spacing/2)})->pp,
|
||||
[ $self->line ],
|
||||
) };
|
||||
die "Intersection has more than two points!\n" if first { @$_ > 2 } @intersections;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue