mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-14 17:12:07 +00:00
Little refactoring, new TriangleMesh->align_to_origin method
This commit is contained in:
@@ -28,14 +28,7 @@ sub new_from_mesh {
|
||||
|
||||
$mesh->rotate($Slic3r::rotate);
|
||||
$mesh->scale($Slic3r::scale / $Slic3r::resolution);
|
||||
|
||||
# calculate the displacements needed to
|
||||
# have lowest value for each axis at coordinate 0
|
||||
{
|
||||
my @extents = $mesh->bounding_box;
|
||||
my @shift = map -$extents[$_][MIN], X,Y,Z;
|
||||
$mesh->move(@shift);
|
||||
}
|
||||
$mesh->align_to_origin;
|
||||
|
||||
# initialize print job
|
||||
my @size = $mesh->size;
|
||||
|
||||
@@ -289,6 +289,15 @@ sub move {
|
||||
}
|
||||
}
|
||||
|
||||
sub align_to_origin {
|
||||
my $self = shift;
|
||||
|
||||
# calculate the displacements needed to
|
||||
# have lowest value for each axis at coordinate 0
|
||||
my @extents = $self->bounding_box;
|
||||
$self->move(map -$extents[$_][MIN], X,Y,Z);
|
||||
}
|
||||
|
||||
sub duplicate {
|
||||
my $self = shift;
|
||||
my (@shifts) = @_;
|
||||
|
||||
Reference in New Issue
Block a user