Fixed regression causing inefficient paths during infill
This commit is contained in:
parent
dcc0ce78db
commit
bf603b0221
3 changed files with 50 additions and 5 deletions
|
@ -12,11 +12,15 @@ sub shortest_path {
|
|||
my $self = shift;
|
||||
my ($start_near) = @_;
|
||||
|
||||
# make sure we pass the same path objects to the Collection constructor
|
||||
# and the ->shortest_path() method because the latter will reverse the
|
||||
# paths in-place when needed and we need to return them that way
|
||||
my @paths = map $_->unpack, @{$self->paths};
|
||||
my $collection = Slic3r::Polyline::Collection->new(
|
||||
polylines => [ map $_->unpack->polyline, @{$self->paths} ],
|
||||
polylines => [ map $_->polyline, @paths ],
|
||||
);
|
||||
|
||||
return $collection->shortest_path($start_near, $self->paths);
|
||||
return $collection->shortest_path($start_near, \@paths);
|
||||
}
|
||||
|
||||
sub cleanup {
|
||||
|
|
|
@ -49,6 +49,11 @@ sub boost_linestring {
|
|||
return Boost::Geometry::Utils::linestring($self);
|
||||
}
|
||||
|
||||
sub wkt {
|
||||
my $self = shift;
|
||||
return sprintf "LINESTRING((%s))", join ',', map "$_->[0] $_->[1]", @$self;
|
||||
}
|
||||
|
||||
sub merge_continuous_lines {
|
||||
my $self = shift;
|
||||
polyline_remove_parallel_continuous_edges($self);
|
||||
|
@ -188,8 +193,9 @@ use Moo;
|
|||
|
||||
has 'polylines' => (is => 'ro', default => sub { [] });
|
||||
|
||||
# if the second argument is provided, this method will return its items sorted
|
||||
# instead of returning the actual sorted polylines
|
||||
# If the second argument is provided, this method will return its items sorted
|
||||
# instead of returning the actual sorted polylines.
|
||||
# Note that our polylines will be reversed in place when necessary.
|
||||
sub shortest_path {
|
||||
my $self = shift;
|
||||
my ($start_near, $items) = @_;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue