This commit is contained in:
Alessandro Ranellucci 2014-01-07 19:08:37 +01:00
parent c8a48b4527
commit 6da98a6ecc
3 changed files with 36 additions and 20 deletions

View file

@ -414,11 +414,17 @@ sub center_around_origin {
my $bb = $self->raw_mesh->bounding_box;
# first align to origin on XYZ
my @shift = @{ $bb->vector_to_origin };
my @shift = (
-$bb->x_min,
-$bb->y_min,
-$bb->z_min,
);
# then center it on XY
my $size = $bb->size;
$shift[$_] -= $size->[$_]/2 for X,Y;
$shift[X] -= $size->x/2;
$shift[Y] -= $size->y/2; #//
$shift[Z] -= $size->z/2;
$self->translate(@shift);