mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-12-11 16:00:17 -07:00
Organize perimeters with a nearest point search to avoid unnecessary travel moves. #21
This commit is contained in:
parent
e860254780
commit
279bfbb10d
3 changed files with 35 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue