mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-23 22:54:08 -06:00
Very large refactoring. Ditched Slic3r::Polyline::Closed and reorganized geometric classes.
This commit is contained in:
parent
2def6a9787
commit
8ed91a8ec4
20 changed files with 293 additions and 349 deletions
|
@ -40,6 +40,11 @@ sub holes {
|
|||
return @$self[1..$#$self];
|
||||
}
|
||||
|
||||
sub lines {
|
||||
my $self = shift;
|
||||
return map $_->lines, @$self;
|
||||
}
|
||||
|
||||
sub clipper_expolygon {
|
||||
my $self = shift;
|
||||
return {
|
||||
|
@ -106,7 +111,7 @@ sub bounding_box {
|
|||
sub clip_line {
|
||||
my $self = shift;
|
||||
my ($line) = @_;
|
||||
$line = Slic3r::Line->cast($line);
|
||||
$line = Slic3r::Line->new($line) if ref $line eq 'ARRAY';
|
||||
|
||||
my @intersections = grep $_, map $_->intersection($line, 1), map $_->lines, @$self;
|
||||
my @dir = (
|
||||
|
@ -203,6 +208,8 @@ sub medial_axis {
|
|||
}
|
||||
return undef if !@skeleton_lines;
|
||||
|
||||
return undef if !@skeleton_lines;
|
||||
|
||||
# now build a single polyline
|
||||
my $polyline = [];
|
||||
{
|
||||
|
@ -248,7 +255,7 @@ sub medial_axis {
|
|||
if (Slic3r::Geometry::same_point($polyline->[0], $polyline->[-1])) {
|
||||
return Slic3r::Polygon->new(@$polyline[0..$#$polyline-1]);
|
||||
} else {
|
||||
return Slic3r::Polyline->cast($polyline);
|
||||
return Slic3r::Polyline->new($polyline);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue