Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorAlessandro Ranellucci <aar@cpan.org>2013-06-16 14:21:25 +0400
committerAlessandro Ranellucci <aar@cpan.org>2013-06-16 14:21:25 +0400
commitac4a0bcdd825d414fb896e97dc227219ffbc9e06 (patch)
tree1bc6cfd74ebb8e264502fa89b65126d050d35313 /utils
parent07407e5dbddfd75bd32379591be6e29205e6627b (diff)
Refactoring: use Slic3r::Geometry::BoundingBox objects everywhere
Diffstat (limited to 'utils')
-rw-r--r--utils/gcode_sectioncut.pl16
1 files changed, 6 insertions, 10 deletions
diff --git a/utils/gcode_sectioncut.pl b/utils/gcode_sectioncut.pl
index 971d49c3b..4304f4aba 100644
--- a/utils/gcode_sectioncut.pl
+++ b/utils/gcode_sectioncut.pl
@@ -54,23 +54,19 @@ my %opt = (
});
# calculate print extents
- my @bounding_box = Slic3r::Geometry::bounding_box([ map @$_, map @$_, values %paths ]);
- my @size = (
- ($bounding_box[X2] - $bounding_box[X1]),
- ($bounding_box[Y2] - $bounding_box[Y1]),
- );
+ my $bounding_box = Slic3r::Geometry::BoundingBox->new_from_points([ map @$_, map @$_, values %paths ]);
# calculate section line
- my $section_y = ($bounding_box[Y2] + $bounding_box[Y1]) / 2;
+ my $section_y = $bounding_box->center->[Y];
my $section_line = [
- [ $bounding_box[X1], $section_y ],
- [ $bounding_box[X2], $section_y ],
+ [ $bounding_box->x_min, $section_y ],
+ [ $bounding_box->x_max, $section_y ],
];
# initialize output
my $max_z = max(keys %paths);
my $svg = SVG->new(
- width => $opt{scale} * $size[X],
+ width => $opt{scale} * $bounding_box->size->[X],
height => $opt{scale} * $max_z,
);
@@ -90,7 +86,7 @@ my %opt = (
) };
$g->rectangle(
- 'x' => $opt{scale} * ($_->[A][X] - $bounding_box[X1]),
+ 'x' => $opt{scale} * ($_->[A][X] - $bounding_box->x_min),
'y' => $opt{scale} * ($max_z - $z),
'width' => $opt{scale} * abs($_->[B][X] - $_->[A][X]),
'height' => $opt{scale} * $opt{layer_height},