2013-07-16 07:49:34 +00:00
|
|
|
package Slic3r::ExPolygon;
|
2011-10-15 09:36:05 +00:00
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
|
|
|
|
# an ExPolygon is a polygon with holes
|
|
|
|
|
2013-03-14 13:27:08 +00:00
|
|
|
use List::Util qw(first);
|
2013-11-21 13:15:38 +00:00
|
|
|
use Slic3r::Geometry::Clipper qw(union_ex diff_pl);
|
2013-07-07 13:17:09 +00:00
|
|
|
|
2011-10-15 09:36:05 +00:00
|
|
|
sub offset {
|
|
|
|
my $self = shift;
|
2013-07-16 22:48:29 +00:00
|
|
|
return Slic3r::Geometry::Clipper::offset(\@$self, @_);
|
2012-08-25 18:04:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sub offset_ex {
|
|
|
|
my $self = shift;
|
2013-07-16 18:09:53 +00:00
|
|
|
return Slic3r::Geometry::Clipper::offset_ex(\@$self, @_);
|
2011-11-16 15:35:20 +00:00
|
|
|
}
|
|
|
|
|
2012-08-25 12:23:46 +00:00
|
|
|
sub noncollapsing_offset_ex {
|
|
|
|
my $self = shift;
|
|
|
|
my ($distance, @params) = @_;
|
|
|
|
|
|
|
|
return $self->offset_ex($distance + 1, @params);
|
|
|
|
}
|
|
|
|
|
2011-11-13 17:14:02 +00:00
|
|
|
sub bounding_box {
|
|
|
|
my $self = shift;
|
2013-06-16 10:21:25 +00:00
|
|
|
return $self->contour->bounding_box;
|
2012-02-25 13:46:21 +00:00
|
|
|
}
|
|
|
|
|
2012-11-23 23:13:04 +00:00
|
|
|
package Slic3r::ExPolygon::Collection;
|
|
|
|
|
|
|
|
sub size {
|
|
|
|
my $self = shift;
|
2013-07-13 22:38:01 +00:00
|
|
|
return [ Slic3r::Geometry::size_2D([ map @$_, map @$_, @$self ]) ];
|
2012-11-23 23:13:04 +00:00
|
|
|
}
|
|
|
|
|
2011-10-15 09:36:05 +00:00
|
|
|
1;
|