parent
d0c08ec5c1
commit
e82ef1094b
@ -102,15 +102,17 @@ void RotoptimizeJob::finalize(bool canceled, std::exception_ptr &eptr)
|
|||||||
auto trmatrix = oi->get_transformation().get_matrix();
|
auto trmatrix = oi->get_transformation().get_matrix();
|
||||||
Polygon trchull = o->convex_hull_2d(trmatrix);
|
Polygon trchull = o->convex_hull_2d(trmatrix);
|
||||||
|
|
||||||
MinAreaBoundigBox rotbb(trchull, MinAreaBoundigBox::pcConvex);
|
if (!trchull.empty()) {
|
||||||
double phi = rotbb.angle_to_X();
|
MinAreaBoundigBox rotbb(trchull, MinAreaBoundigBox::pcConvex);
|
||||||
|
double phi = rotbb.angle_to_X();
|
||||||
|
|
||||||
// The box should be landscape
|
// The box should be landscape
|
||||||
if(rotbb.width() < rotbb.height()) phi += PI / 2;
|
if(rotbb.width() < rotbb.height()) phi += PI / 2;
|
||||||
|
|
||||||
Vec3d rt = oi->get_rotation(); rt(Z) += phi;
|
Vec3d rt = oi->get_rotation(); rt(Z) += phi;
|
||||||
|
|
||||||
oi->set_rotation(rt);
|
oi->set_rotation(rt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Correct the z offset of the object which was corrupted be
|
// Correct the z offset of the object which was corrupted be
|
||||||
|
Loading…
Reference in New Issue
Block a user