Enabling convex hull optimization for arrange.

Seems to work nicely
This commit is contained in:
tamasmeszaros 2019-03-19 15:01:58 +01:00
parent 9076fb2be1
commit 78ac357d34

View File

@ -556,29 +556,7 @@ ShapeData2D projectModelFromTop(const Slic3r::Model &model) {
// TODO export the exact 2D projection. Cannot do it as libnest2d
// does not support concave shapes (yet).
ClipperLib::Path clpath;
//WIP Vojtech's optimization of the calculation of the convex hull is not working correctly yet.
#if 1
{
TriangleMesh rmesh = objptr->raw_mesh();
ModelInstance * finst = objptr->instances.front();
// Object instances should carry the same scaling and
// x, y rotation that is why we use the first instance.
// The next line will apply only the full mirroring and scaling
rmesh.transform(finst->get_matrix(true, true, false, false));
rmesh.rotate_x(float(finst->get_rotation()(X)));
rmesh.rotate_y(float(finst->get_rotation()(Y)));
// TODO export the exact 2D projection. Cannot do it as libnest2d
// does not support concave shapes (yet).
auto p = rmesh.convex_hull();
p.make_clockwise();
p.append(p.first_point());
clpath = Slic3rMultiPoint_to_ClipperPath(p);
}
#else
// Object instances should carry the same scaling and
// x, y rotation that is why we use the first instance.
{
@ -593,7 +571,6 @@ ShapeData2D projectModelFromTop(const Slic3r::Model &model) {
p.append(p.first_point());
clpath = Slic3rMultiPoint_to_ClipperPath(p);
}
#endif
for(ModelInstance* objinst : objptr->instances) {
if(objinst) {