Rotation around X and Y axes from plater

This commit is contained in:
Alessandro Ranellucci 2014-06-14 20:52:21 +02:00
parent 51cf78534c
commit ec7bb40da9
4 changed files with 51 additions and 21 deletions

View file

@ -463,13 +463,19 @@ sub translate {
$self->_bounding_box->translate(@shift) if defined $self->_bounding_box;
}
sub rotate_x {
my ($self, $angle) = @_;
sub rotate {
my ($self, $angle, $axis) = @_;
# we accept angle in radians but mesh currently uses degrees
$angle = rad2deg($angle);
$_->mesh->rotate_x($angle) for @{$self->volumes};
if ($axis == X) {
$_->mesh->rotate_x($angle) for @{$self->volumes};
} elsif ($axis == Y) {
$_->mesh->rotate_y($angle) for @{$self->volumes};
} elsif ($axis == Z) {
$_->mesh->rotate_z($angle) for @{$self->volumes};
}
$self->invalidate_bounding_box;
}