mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-17 10:32:20 +00:00
Organize perimeters with a nearest point search to avoid unnecessary travel moves. #21
This commit is contained in:
@@ -3,6 +3,7 @@ use Moo;
|
||||
|
||||
use Math::Clipper ':all';
|
||||
use Math::ConvexHull 1.0.4 qw(convex_hull);
|
||||
use Slic3r::Geometry qw(shortest_path);
|
||||
use XXX;
|
||||
|
||||
use constant X => 0;
|
||||
@@ -31,6 +32,11 @@ sub make_perimeter {
|
||||
# )
|
||||
my @perimeters = (); # one item per depth; each item
|
||||
|
||||
# organize $layer->perimeter_surfaces using a shortest path search
|
||||
@{ $layer->perimeter_surfaces } = @{shortest_path([
|
||||
map [ $_->contour->points->[0], $_ ], @{ $layer->perimeter_surfaces },
|
||||
])};
|
||||
|
||||
foreach my $surface (@{ $layer->perimeter_surfaces }) {
|
||||
# the outer loop must be offsetted by half extrusion width inwards
|
||||
my @last_offsets = ($surface->expolygon);
|
||||
|
||||
Reference in New Issue
Block a user