mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-16 18:12:10 +00:00
Ported ModelObject::rotate() and ModelObject::flip() to XS, as well as axes constants
This commit is contained in:
@@ -27,9 +27,6 @@ our @EXPORT_OK = qw(
|
||||
use constant PI => 4 * atan2(1, 1);
|
||||
use constant A => 0;
|
||||
use constant B => 1;
|
||||
use constant X => 0;
|
||||
use constant Y => 1;
|
||||
use constant Z => 2;
|
||||
use constant X1 => 0;
|
||||
use constant Y1 => 1;
|
||||
use constant X2 => 2;
|
||||
|
||||
@@ -262,37 +262,6 @@ sub add_instance {
|
||||
}
|
||||
}
|
||||
|
||||
sub rotate {
|
||||
my ($self, $angle, $axis) = @_;
|
||||
|
||||
# we accept angle in radians but mesh currently uses degrees
|
||||
$angle = rad2deg($angle);
|
||||
|
||||
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->set_origin_translation(Slic3r::Pointf3->new(0,0,0));
|
||||
$self->invalidate_bounding_box;
|
||||
}
|
||||
|
||||
sub flip {
|
||||
my ($self, $axis) = @_;
|
||||
|
||||
if ($axis == X) {
|
||||
$_->mesh->flip_x for @{$self->volumes};
|
||||
} elsif ($axis == Y) {
|
||||
$_->mesh->flip_y for @{$self->volumes};
|
||||
} elsif ($axis == Z) {
|
||||
$_->mesh->flip_z for @{$self->volumes};
|
||||
}
|
||||
$self->set_origin_translation(Slic3r::Pointf3->new(0,0,0));
|
||||
$self->invalidate_bounding_box;
|
||||
}
|
||||
|
||||
sub mesh_stats {
|
||||
my $self = shift;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user