New option to rotate input object

This commit is contained in:
Alessandro Ranellucci 2011-09-26 16:07:12 +02:00
parent 8d13d4b21e
commit 404c76adc8
4 changed files with 16 additions and 3 deletions

View file

@ -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);