Faster support generation. Includes a new implementation of the Douglas-Peucker algorithm

This commit is contained in:
Alessandro Ranellucci 2012-02-25 14:46:21 +01:00
parent 94e673e050
commit eba7c10018
9 changed files with 166 additions and 183 deletions

View file

@ -108,6 +108,17 @@ sub bounding_box {
return Slic3r::Geometry::bounding_box($self->contour);
}
sub bounding_box_polygon {
my $self = shift;
my @bb = $self->bounding_box;
return Slic3r::Polygon->new([
[ $bb[0], $bb[1] ],
[ $bb[2], $bb[1] ],
[ $bb[2], $bb[3] ],
[ $bb[0], $bb[3] ],
]);
}
sub clip_line {
my $self = shift;
my ($line) = @_;
@ -141,6 +152,11 @@ sub clip_line {
return [@lines];
}
sub simplify {
my $self = shift;
$_->simplify(@_) for @$self;
}
sub translate {
my $self = shift;
$_->translate(@_) for @$self;