fix some remaining bounding box calls

This commit is contained in:
Michael Kirsch 2019-05-26 01:11:04 +02:00 committed by Joseph Lenox
parent 5bfba440a0
commit 53ed1cd992

View File

@ -402,7 +402,7 @@ Model::looks_like_multipart_object() const
std::set<coordf_t> heights; std::set<coordf_t> heights;
for (const ModelObject* o : this->objects) for (const ModelObject* o : this->objects)
for (const ModelVolume* v : o->volumes) for (const ModelVolume* v : o->volumes)
heights.insert(v->mesh.bounding_box().min.z); heights.insert(v->get_transformed_bounding_box().min.z);
return heights.size() > 1; return heights.size() > 1;
} }
@ -678,12 +678,10 @@ Model::align_to_ground()
void void
ModelObject::align_to_ground() ModelObject::align_to_ground()
{ {
// calculate the displacements needed to
// center this object around the origin
BoundingBoxf3 bb; BoundingBoxf3 bb;
for (const ModelVolume* v : this->volumes) for (const ModelVolume* v : this->volumes)
if (!v->modifier) if (!v->modifier)
bb.merge(v->mesh.bounding_box()); bb.merge(v->get_transformed_bounding_box());
this->translate(0, 0, -bb.min.z); this->translate(0, 0, -bb.min.z);
this->origin_translation.translate(0, 0, -bb.min.z); this->origin_translation.translate(0, 0, -bb.min.z);
@ -697,7 +695,7 @@ ModelObject::center_around_origin()
BoundingBoxf3 bb; BoundingBoxf3 bb;
for (ModelVolumePtrs::const_iterator v = this->volumes.begin(); v != this->volumes.end(); ++v) for (ModelVolumePtrs::const_iterator v = this->volumes.begin(); v != this->volumes.end(); ++v)
if (! (*v)->modifier) if (! (*v)->modifier)
bb.merge((*v)->mesh.bounding_box()); bb.merge((*v)->get_transformed_bounding_box());
// first align to origin on XYZ // first align to origin on XYZ
Vectorf3 vector(-bb.min.x, -bb.min.y, -bb.min.z); Vectorf3 vector(-bb.min.x, -bb.min.y, -bb.min.z);