Removed chained_path_items()
This commit is contained in:
parent
0045f84ed2
commit
30297ee4dc
3 changed files with 9 additions and 23 deletions
|
@ -7,7 +7,7 @@ our @ISA = qw(Exporter);
|
||||||
our @EXPORT_OK = qw(
|
our @EXPORT_OK = qw(
|
||||||
PI X Y Z A B X1 Y1 X2 Y2 Z1 Z2 MIN MAX epsilon slope line_atan lines_parallel
|
PI X Y Z A B X1 Y1 X2 Y2 Z1 Z2 MIN MAX epsilon slope line_atan lines_parallel
|
||||||
line_point_belongs_to_segment points_coincide distance_between_points
|
line_point_belongs_to_segment points_coincide distance_between_points
|
||||||
chained_path_items normalize tan move_points_3D
|
normalize tan move_points_3D
|
||||||
point_in_polygon point_in_segment segment_in_segment
|
point_in_polygon point_in_segment segment_in_segment
|
||||||
polyline_lines polygon_lines
|
polyline_lines polygon_lines
|
||||||
point_along_segment polygon_segment_having_point polygon_has_subsegment
|
point_along_segment polygon_segment_having_point polygon_has_subsegment
|
||||||
|
@ -565,19 +565,6 @@ sub polyline_remove_short_segments {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# accepts an arrayref; each item should be an arrayref whose first
|
|
||||||
# item is the point to be used for the shortest path, and the second
|
|
||||||
# one is the value to be returned in output (if the second item
|
|
||||||
# is not provided, the point will be returned)
|
|
||||||
sub chained_path_items {
|
|
||||||
my ($items, $start_near) = @_;
|
|
||||||
|
|
||||||
my @indices = defined($start_near)
|
|
||||||
? @{chained_path_from([ map $_->[0], @$items ], $start_near)}
|
|
||||||
: @{chained_path([ map $_->[0], @$items ])};
|
|
||||||
return [ map $_->[1], @$items[@indices] ];
|
|
||||||
}
|
|
||||||
|
|
||||||
sub douglas_peucker {
|
sub douglas_peucker {
|
||||||
my ($points, $tolerance) = @_;
|
my ($points, $tolerance) = @_;
|
||||||
no warnings "recursion";
|
no warnings "recursion";
|
||||||
|
|
|
@ -10,15 +10,15 @@ our @EXPORT_OK = qw(offset offset_ex
|
||||||
intersection intersection_pl diff_pl union CLIPPER_OFFSET_SCALE);
|
intersection intersection_pl diff_pl union CLIPPER_OFFSET_SCALE);
|
||||||
|
|
||||||
use Slic3r::Geometry qw(scale);
|
use Slic3r::Geometry qw(scale);
|
||||||
|
use Slic3r::Geometry qw(chained_path);
|
||||||
|
|
||||||
sub traverse_pt {
|
sub traverse_pt {
|
||||||
my ($polynodes) = @_;
|
my ($polynodes) = @_;
|
||||||
|
|
||||||
# use a nearest neighbor search to order these children
|
# use a nearest neighbor search to order these children
|
||||||
# TODO: supply second argument to chained_path_items() too?
|
# TODO: supply second argument to chained_path() too?
|
||||||
my @nodes = @{Slic3r::Geometry::chained_path_items(
|
my @ordering_points = map { ($_->{outer} // $_->{hole})->first_point } @$polynodes;
|
||||||
[ map [ ($_->{outer} ? $_->{outer}[0] : $_->{hole}[0]), $_ ], @$polynodes ],
|
my @nodes = @$polynodes[ @{chained_path(\@ordering_points)} ];
|
||||||
)};
|
|
||||||
|
|
||||||
my @polygons = ();
|
my @polygons = ();
|
||||||
foreach my $polynode (@$polynodes) {
|
foreach my $polynode (@$polynodes) {
|
||||||
|
|
|
@ -3,7 +3,7 @@ use Moo;
|
||||||
|
|
||||||
use List::Util qw(sum first);
|
use List::Util qw(sum first);
|
||||||
use Slic3r::ExtrusionPath ':roles';
|
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 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 intersection_pl);
|
union diff intersection_pl);
|
||||||
|
@ -236,10 +236,9 @@ sub make_perimeters {
|
||||||
my ($polynodes, $depth, $is_contour) = @_;
|
my ($polynodes, $depth, $is_contour) = @_;
|
||||||
|
|
||||||
# use a nearest neighbor search to order these children
|
# use a nearest neighbor search to order these children
|
||||||
# TODO: supply second argument to chained_path_items() too?
|
# TODO: supply second argument to chained_path() too?
|
||||||
my @nodes = @{Slic3r::Geometry::chained_path_items(
|
my @ordering_points = map { ($_->{outer} // $_->{hole})->first_point } @$polynodes;
|
||||||
[ map [ ($_->{outer} // $_->{hole})->first_point, $_ ], @$polynodes ],
|
my @nodes = @$polynodes[@{chained_path(\@ordering_points)}];
|
||||||
)};
|
|
||||||
|
|
||||||
my @loops = ();
|
my @loops = ();
|
||||||
foreach my $polynode (@nodes) {
|
foreach my $polynode (@nodes) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue