diff options
Diffstat (limited to 'lib/Slic3r/Geometry/BoundingBox.pm')
-rw-r--r-- | lib/Slic3r/Geometry/BoundingBox.pm | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/lib/Slic3r/Geometry/BoundingBox.pm b/lib/Slic3r/Geometry/BoundingBox.pm index c2d27a1fe..7b720e531 100644 --- a/lib/Slic3r/Geometry/BoundingBox.pm +++ b/lib/Slic3r/Geometry/BoundingBox.pm @@ -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; |