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
diff options
context:
space:
mode:
authorAlessandro Ranellucci <aar@cpan.org>2011-09-26 18:07:12 +0400
committerAlessandro Ranellucci <aar@cpan.org>2011-09-26 18:07:12 +0400
commit404c76adc804523fbc870b9a18b6267f38071f14 (patch)
tree685205dd4fe4472abe6252fdf6b46b23475d783a /lib/Slic3r/STL.pm
parent8d13d4b21e3959c314710d6dcc5a0cca4c9f0678 (diff)
New option to rotate input object
Diffstat (limited to 'lib/Slic3r/STL.pm')
-rw-r--r--lib/Slic3r/STL.pm10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Slic3r/STL.pm b/lib/Slic3r/STL.pm
index ac5843406..a72714114 100644
--- a/lib/Slic3r/STL.pm
+++ b/lib/Slic3r/STL.pm
@@ -18,6 +18,16 @@ sub parse_file {
# open STL file
my $stl = CAD::Format::STL->new->load($file);
+ if ($Slic3r::rotate > 0) {
+ my $deg = Slic3r::Geometry::deg2rad($Slic3r::rotate);
+ foreach my $facet ($stl->part->facets) {
+ my ($normal, @vertices) = @$facet;
+ foreach my $vertex (@vertices) {
+ @$vertex = (@{ +(Slic3r::Geometry::rotate_points($deg, undef, [ $vertex->[X], $vertex->[Y] ]))[0] }, $vertex->[Z]);
+ }
+ }
+ }
+
# we only want to work with positive coordinates, so let's
# find our object extents to calculate coordinate displacements
my @extents = (map [99999999, -99999999], X,Y,Z);