Removed chained_path_points()

This commit is contained in:
Alessandro Ranellucci 2013-11-23 21:42:01 +01:00
parent 0516aac715
commit 0045f84ed2
3 changed files with 5 additions and 10 deletions

View File

@ -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 chained_path_points normalize tan move_points_3D chained_path_items 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
@ -578,11 +578,6 @@ sub chained_path_items {
return [ map $_->[1], @$items[@indices] ]; return [ map $_->[1], @$items[@indices] ];
} }
sub chained_path_points {
my ($points, $start_near) = @_;
return [ @$points[ @{chained_path_from($points, $start_near)} ] ];
}
sub douglas_peucker { sub douglas_peucker {
my ($points, $tolerance) = @_; my ($points, $tolerance) = @_;
no warnings "recursion"; no warnings "recursion";

View File

@ -2,7 +2,7 @@ package Slic3r::Print::Object;
use Moo; use Moo;
use List::Util qw(min max sum first); use List::Util qw(min max sum first);
use Slic3r::Geometry qw(X Y Z PI scale unscale deg2rad rad2deg scaled_epsilon chained_path_points); use Slic3r::Geometry qw(X Y Z PI scale unscale deg2rad rad2deg scaled_epsilon chained_path);
use Slic3r::Geometry::Clipper qw(diff diff_ex intersection intersection_ex union union_ex use Slic3r::Geometry::Clipper qw(diff diff_ex intersection intersection_ex union union_ex
offset offset_ex offset2 offset2_ex CLIPPER_OFFSET_SCALE JT_MITER); offset offset_ex offset2 offset2_ex CLIPPER_OFFSET_SCALE JT_MITER);
use Slic3r::Surface ':types'; use Slic3r::Surface ':types';
@ -85,7 +85,7 @@ sub _trigger_copies {
return unless @{$self->copies} > 1; return unless @{$self->copies} > 1;
# order copies with a nearest neighbor search # order copies with a nearest neighbor search
@{$self->copies} = @{chained_path_points($self->copies)} @{$self->copies} = @{$self->copies}[@{chained_path($self->copies)}];
} }
sub init_config { sub init_config {

View File

@ -11,7 +11,7 @@ BEGIN {
use Slic3r; use Slic3r;
use Slic3r::Geometry qw(PI polygon_is_convex use Slic3r::Geometry qw(PI polygon_is_convex
chained_path_points epsilon scale); chained_path epsilon scale);
#========================================================== #==========================================================
@ -162,7 +162,7 @@ my $polygons = [
# if chained_path() works correctly, these points should be joined with no diagonal paths # if chained_path() works correctly, these points should be joined with no diagonal paths
# (thus 26 units long) # (thus 26 units long)
my @points = map Slic3r::Point->new_scale(@$_), [26,26],[52,26],[0,26],[26,52],[26,0],[0,52],[52,52],[52,0]; my @points = map Slic3r::Point->new_scale(@$_), [26,26],[52,26],[0,26],[26,52],[26,0],[0,52],[52,52],[52,0];
my @ordered = @{chained_path_points(\@points, $points[0])}; my @ordered = @points[@{chained_path(\@points, $points[0])}];
ok !(grep { abs($ordered[$_]->distance_to($ordered[$_+1]) - scale 26) > epsilon } 0..$#ordered-1), 'chained_path'; ok !(grep { abs($ordered[$_]->distance_to($ordered[$_+1]) - scale 26) > epsilon } 0..$#ordered-1), 'chained_path';
} }