diff options
author | Alessandro Ranellucci <aar@cpan.org> | 2011-09-04 14:04:01 +0400 |
---|---|---|
committer | Alessandro Ranellucci <aar@cpan.org> | 2011-09-04 14:04:01 +0400 |
commit | 428006264dadc49243332537087533bcf73ad1e2 (patch) | |
tree | fea9e06401e902ace8a19424f85059a94b36adcc /lib/Slic3r/Surface.pm | |
parent | 416ad241eafd75f9bb264adad1c4f5c7e2194c56 (diff) |
Generate boundaries of areas to fill (includes some refactoring)
Diffstat (limited to 'lib/Slic3r/Surface.pm')
-rw-r--r-- | lib/Slic3r/Surface.pm | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/Slic3r/Surface.pm b/lib/Slic3r/Surface.pm index d8ab0ddc5..5333a7eb6 100644 --- a/lib/Slic3r/Surface.pm +++ b/lib/Slic3r/Surface.pm @@ -42,6 +42,20 @@ sub BUILD { $_->hole_of($self) for @{ $self->holes }; } +sub new_from_mgp { + my $self = shift; + my ($polygon) = @_; + + my ($contour_p, @holes_p) = @{ $polygon->polygons }; + + return __PACKAGE__->new( + contour => Slic3r::Polyline::Closed->new_from_points(@$contour_p), + holes => [ + map Slic3r::Polyline::Closed->new_from_points(@$_), @holes_p + ], + ); +} + sub id { my $self = shift; return $self->contour->id; |