Tweaks to ModelObject::center_around_origin()

This commit is contained in:
Enrico Turri 2018-09-06 08:56:33 +02:00
parent 677dad0669
commit b9287d51dd

View file

@ -669,10 +669,9 @@ void ModelObject::center_around_origin()
if (! v->modifier) if (! v->modifier)
bb.merge(v->mesh.bounding_box()); bb.merge(v->mesh.bounding_box());
// First align to origin on XYZ, then center it on XY. // Shift is the vector from the center of the bottom face of the bounding box to the origin
Vec3d size = bb.size(); Vec3d shift = -bb.center();
size(2) = 0.0; shift(2) = -bb.min(2);
Vec3d shift = -bb.min - 0.5 * size;
this->translate(shift); this->translate(shift);
this->origin_translation += shift; this->origin_translation += shift;