Removed clip_with_polygon() and clip_with_expolygon()
This commit is contained in:
parent
ac88fbcbb0
commit
3aef663f7f
@ -10,29 +10,9 @@ our @EXPORT_OK = qw(EXTR_ROLE_PERIMETER EXTR_ROLE_EXTERNAL_PERIMETER
|
|||||||
EXTR_ROLE_INTERNALBRIDGE EXTR_ROLE_SKIRT EXTR_ROLE_SUPPORTMATERIAL EXTR_ROLE_GAPFILL);
|
EXTR_ROLE_INTERNALBRIDGE EXTR_ROLE_SKIRT EXTR_ROLE_SUPPORTMATERIAL EXTR_ROLE_GAPFILL);
|
||||||
our %EXPORT_TAGS = (roles => \@EXPORT_OK);
|
our %EXPORT_TAGS = (roles => \@EXPORT_OK);
|
||||||
|
|
||||||
sub clip_with_polygon {
|
|
||||||
my $self = shift;
|
|
||||||
my ($polygon) = @_;
|
|
||||||
|
|
||||||
return $self->clip_with_expolygon(Slic3r::ExPolygon->new($polygon));
|
|
||||||
}
|
|
||||||
|
|
||||||
sub clip_with_expolygon {
|
|
||||||
my $self = shift;
|
|
||||||
my ($expolygon) = @_;
|
|
||||||
|
|
||||||
return map $self->clone(polyline => $_),
|
|
||||||
$self->polyline->clip_with_expolygon($expolygon);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub simplify {
|
sub simplify {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
$self->polyline($self->polyline->simplify(@_));
|
$self->polyline($self->polyline->simplify(@_));
|
||||||
}
|
}
|
||||||
|
|
||||||
sub points {
|
|
||||||
my $self = shift;
|
|
||||||
return $self->polyline;
|
|
||||||
}
|
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
@ -4,6 +4,7 @@ use Moo;
|
|||||||
extends 'Slic3r::Fill::Base';
|
extends 'Slic3r::Fill::Base';
|
||||||
|
|
||||||
use Slic3r::Geometry qw(scale X1 Y1 X2 Y2);
|
use Slic3r::Geometry qw(scale X1 Y1 X2 Y2);
|
||||||
|
use Slic3r::Geometry::Clipper qw(intersection_pl);
|
||||||
|
|
||||||
sub multiplier () { 1 }
|
sub multiplier () { 1 }
|
||||||
|
|
||||||
@ -40,8 +41,7 @@ sub fill_surface {
|
|||||||
|
|
||||||
$self->process_polyline($polyline, $bounding_box);
|
$self->process_polyline($polyline, $bounding_box);
|
||||||
|
|
||||||
my @paths = map $_->clip_with_expolygon($expolygon),
|
my @paths = @{intersection_pl([$polyline], \@$expolygon)};
|
||||||
$polyline->clip_with_polygon($bounding_box->polygon);
|
|
||||||
|
|
||||||
if (0) {
|
if (0) {
|
||||||
require "Slic3r/SVG.pm";
|
require "Slic3r/SVG.pm";
|
||||||
|
@ -6,7 +6,7 @@ use Slic3r::ExtrusionPath ':roles';
|
|||||||
use Slic3r::Geometry qw(PI A B scale unscale chained_path_items points_coincide);
|
use Slic3r::Geometry qw(PI A B scale unscale chained_path_items points_coincide);
|
||||||
use Slic3r::Geometry::Clipper qw(union_ex diff_ex intersection_ex
|
use Slic3r::Geometry::Clipper qw(union_ex diff_ex intersection_ex
|
||||||
offset offset2 offset2_ex union_pt traverse_pt diff intersection
|
offset offset2 offset2_ex union_pt traverse_pt diff intersection
|
||||||
union diff);
|
union diff intersection_pl);
|
||||||
use Slic3r::Surface ':types';
|
use Slic3r::Surface ':types';
|
||||||
|
|
||||||
has 'layer' => (
|
has 'layer' => (
|
||||||
@ -491,7 +491,7 @@ sub _detect_bridge_direction {
|
|||||||
foreach my $lower (@lower) {
|
foreach my $lower (@lower) {
|
||||||
# turn bridge contour and holes into polylines and then clip them
|
# turn bridge contour and holes into polylines and then clip them
|
||||||
# with each lower slice's contour
|
# with each lower slice's contour
|
||||||
my @clipped = map $_->split_at_first_point->clip_with_polygon($lower->contour), map @$_, @$grown;
|
my @clipped = @{intersection_pl([ map $_->split_at_first_point, map @$_, @$grown ], [$lower->contour])};
|
||||||
if (@clipped == 2) {
|
if (@clipped == 2) {
|
||||||
# If the split_at_first_point() call above happens to split the polygon inside the clipping area
|
# If the split_at_first_point() call above happens to split the polygon inside the clipping area
|
||||||
# we would get two consecutive polylines instead of a single one, so we use this ugly hack to
|
# we would get two consecutive polylines instead of a single one, so we use this ugly hack to
|
||||||
|
@ -35,21 +35,6 @@ sub simplify {
|
|||||||
return __PACKAGE__->new(@$simplified);
|
return __PACKAGE__->new(@$simplified);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub clip_with_polygon {
|
|
||||||
my $self = shift;
|
|
||||||
my ($polygon) = @_;
|
|
||||||
|
|
||||||
return $self->clip_with_expolygon(Slic3r::ExPolygon->new($polygon));
|
|
||||||
}
|
|
||||||
|
|
||||||
sub clip_with_expolygon {
|
|
||||||
my $self = shift;
|
|
||||||
my ($expolygon) = @_;
|
|
||||||
|
|
||||||
my $result = Boost::Geometry::Utils::polygon_multi_linestring_intersection($expolygon->pp, [$self->pp]);
|
|
||||||
return map { __PACKAGE__->new(@$_) } @$result;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub bounding_box {
|
sub bounding_box {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
return Slic3r::Geometry::BoundingBox->new_from_points($self);
|
return Slic3r::Geometry::BoundingBox->new_from_points($self);
|
||||||
|
Loading…
Reference in New Issue
Block a user