Better fix for minimum z of object to lay on the bed after rotations
This commit is contained in:
parent
93b8f3147c
commit
6742735596
@ -771,21 +771,12 @@ void ModelObject::scale(const Pointf3 &versor)
|
||||
|
||||
void ModelObject::rotate(float angle, const Axis &axis)
|
||||
{
|
||||
float min_z = FLT_MAX;
|
||||
for (ModelVolume *v : this->volumes)
|
||||
{
|
||||
v->mesh.rotate(angle, axis);
|
||||
min_z = std::min(min_z, v->mesh.stl.stats.min.z);
|
||||
}
|
||||
|
||||
if (min_z != 0.0f)
|
||||
{
|
||||
// translate the object so that its minimum z lays on the bed
|
||||
for (ModelVolume *v : this->volumes)
|
||||
{
|
||||
v->mesh.translate(0.0f, 0.0f, -min_z);
|
||||
}
|
||||
}
|
||||
center_around_origin();
|
||||
|
||||
this->origin_translation = Pointf3(0, 0, 0);
|
||||
this->invalidate_bounding_box();
|
||||
|
Loading…
Reference in New Issue
Block a user