mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-18 04:08:02 -06:00
New --fill-every-layers option to get high accuracy on external surfaces while speeding up infill
This commit is contained in:
parent
54cc6216a1
commit
7f341cfcd3
16 changed files with 177 additions and 43 deletions
|
@ -4,11 +4,27 @@ use warnings;
|
|||
|
||||
require Exporter;
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT_OK = qw(diff_ex diff union_ex);
|
||||
our @EXPORT_OK = qw(explode_expolygon explode_expolygons safety_offset
|
||||
diff_ex diff union_ex intersection_ex);
|
||||
|
||||
use Math::Clipper 1.02 ':all';
|
||||
our $clipper = Math::Clipper->new;
|
||||
|
||||
sub explode_expolygon {
|
||||
my ($expolygon) = @_;
|
||||
return ($expolygon->{outer}, @{ $expolygon->{holes} });
|
||||
}
|
||||
|
||||
sub explode_expolygons {
|
||||
my ($expolygons) = @_;
|
||||
return map explode_expolygon($_), @$expolygons;
|
||||
}
|
||||
|
||||
sub safety_offset {
|
||||
my ($polygons) = @_;
|
||||
return Math::Clipper::offset($polygons, 100, 100, JT_MITER, 2);
|
||||
}
|
||||
|
||||
sub diff_ex {
|
||||
my ($subject, $clip) = @_;
|
||||
|
||||
|
@ -29,4 +45,13 @@ sub union_ex {
|
|||
return $clipper->ex_execute(CT_UNION, PFT_NONZERO, PFT_NONZERO);
|
||||
}
|
||||
|
||||
sub intersection_ex {
|
||||
my ($subject, $clip) = @_;
|
||||
|
||||
$clipper->clear;
|
||||
$clipper->add_subject_polygons($subject);
|
||||
$clipper->add_clip_polygons($clip);
|
||||
return $clipper->ex_execute(CT_INTERSECTION, PFT_NONZERO, PFT_NONZERO);
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue