Refactoring: use Slic3r::Geometry::BoundingBox objects everywhere

This commit is contained in:
Alessandro Ranellucci 2013-06-16 12:21:25 +02:00
parent 07407e5dbd
commit ac4a0bcdd8
20 changed files with 105 additions and 127 deletions

View file

@ -36,7 +36,14 @@ sub bb {
sub polygon {
my $self = shift;
return Slic3r::Polygon->new_from_bounding_box($self->bb);
my $e = $self->extents;
return Slic3r::Polygon->new([
[ $e->[X][MIN], $e->[Y][MIN] ],
[ $e->[X][MAX], $e->[Y][MIN] ],
[ $e->[X][MAX], $e->[Y][MAX] ],
[ $e->[X][MIN], $e->[Y][MAX] ],
]);
}
# note to $self
@ -84,4 +91,24 @@ sub max_point {
return Slic3r::Point->new($self->extents->[X][MAX], $self->extents->[Y][MAX]);
}
sub x_min {
my $self = shift;
return $self->extents->[X][MIN];
}
sub x_max {
my $self = shift;
return $self->extents->[X][MAX];
}
sub y_min {
my $self = shift;
return $self->extents->[Y][MIN];
}
sub y_max {
my $self = shift;
return $self->extents->[Y][MAX];
}
1;