mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-07 23:17:35 -06:00
ENH: disable arranging selected items
0. disable arranging selected 1. fix bug where brim is not correct. 2. fix bug where big circle objects are not arranged properly 3. disable default enable_rotation Change-Id: Ifc69f35d900ff63ec1e9ec8bf8638afc6ea7d54b (cherry picked from commit 2ed1b0dd8573a1e10aaf77f0d9f8896cef304427)
This commit is contained in:
parent
74e92ac51d
commit
07ae246e5f
9 changed files with 77 additions and 31 deletions
|
@ -136,6 +136,25 @@ static double fixed_overfit(const std::tuple<double, Box>& result, const Box &bi
|
|||
return score;
|
||||
}
|
||||
|
||||
// useful for arranging big circle objects
|
||||
static double fixed_overfit_topright_sliding(const std::tuple<double, Box>& result, const Box& binbb)
|
||||
{
|
||||
double score = std::get<0>(result);
|
||||
Box pilebb = std::get<1>(result);
|
||||
|
||||
auto shift = binbb.maxCorner() - pilebb.maxCorner();
|
||||
shift.x() = std::max(0, shift.x()); // do not allow left shift
|
||||
shift.y() = std::max(0, shift.y()); // do not allow bottom shift
|
||||
pilebb.minCorner() += shift;
|
||||
pilebb.maxCorner() += shift;
|
||||
|
||||
Box fullbb = sl::boundingBox(pilebb, binbb);
|
||||
auto diff = double(fullbb.area()) - binbb.area();
|
||||
if (diff > 0) score += diff;
|
||||
|
||||
return score;
|
||||
}
|
||||
|
||||
// A class encapsulating the libnest2d Nester class and extending it with other
|
||||
// management and spatial index structures for acceleration.
|
||||
template<class TBin>
|
||||
|
@ -503,8 +522,9 @@ public:
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
cfg.object_function = [this, bb, starting_point](const Item& item) {
|
||||
return fixed_overfit(objfunc(item, starting_point), bb);
|
||||
return fixed_overfit_topright_sliding(objfunc(item, starting_point), bb);
|
||||
};
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue