mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-05-31 02:24:27 +08:00
Precision raised and big item classification improved
This commit is contained in:
parent
d1bd5a51b2
commit
224c0e74ea
@ -706,7 +706,7 @@ public:
|
|||||||
|
|
||||||
opt::StopCriteria stopcr;
|
opt::StopCriteria stopcr;
|
||||||
stopcr.max_iterations = 100;
|
stopcr.max_iterations = 100;
|
||||||
stopcr.relative_score_difference = 1e-6;
|
stopcr.relative_score_difference = 1e-12;
|
||||||
opt::TOptimizer<opt::Method::L_SUBPLEX> solver(stopcr);
|
opt::TOptimizer<opt::Method::L_SUBPLEX> solver(stopcr);
|
||||||
|
|
||||||
Optimum optimum(0, 0);
|
Optimum optimum(0, 0);
|
||||||
|
@ -115,15 +115,18 @@ objfunc(const PointImpl& bincenter,
|
|||||||
using pl = PointLike;
|
using pl = PointLike;
|
||||||
using sl = ShapeLike;
|
using sl = ShapeLike;
|
||||||
|
|
||||||
static const double BIG_ITEM_TRESHOLD = 0.04;
|
static const double BIG_ITEM_TRESHOLD = 0.02;
|
||||||
static const double ROUNDNESS_RATIO = 0.5;
|
static const double ROUNDNESS_RATIO = 0.5;
|
||||||
static const double DENSITY_RATIO = 1.0 - ROUNDNESS_RATIO;
|
static const double DENSITY_RATIO = 1.0 - ROUNDNESS_RATIO;
|
||||||
|
|
||||||
// We will treat big items (compared to the print bed) differently
|
// We will treat big items (compared to the print bed) differently
|
||||||
|
|
||||||
auto isBig = [&areacache, bin_area](double a) {
|
auto isBig = [&areacache, bin_area](double a) {
|
||||||
bool t = areacache.empty() ? true : a > 0.5*areacache.front();
|
double farea = areacache.empty() ? 0 : areacache.front();
|
||||||
return a/bin_area > BIG_ITEM_TRESHOLD || t;
|
bool fbig = farea / bin_area > BIG_ITEM_TRESHOLD;
|
||||||
|
bool abig = a/bin_area > BIG_ITEM_TRESHOLD;
|
||||||
|
bool rbig = fbig && a > 0.5*farea;
|
||||||
|
return abig || rbig;
|
||||||
};
|
};
|
||||||
|
|
||||||
// If a new bin has been created:
|
// If a new bin has been created:
|
||||||
@ -258,7 +261,7 @@ void fillConfig(PConf& pcfg) {
|
|||||||
|
|
||||||
// The accuracy of optimization.
|
// The accuracy of optimization.
|
||||||
// Goes from 0.0 to 1.0 and scales performance as well
|
// Goes from 0.0 to 1.0 and scales performance as well
|
||||||
pcfg.accuracy = 0.6f;
|
pcfg.accuracy = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class TBin>
|
template<class TBin>
|
||||||
@ -355,7 +358,7 @@ public:
|
|||||||
auto diff = d - 2*bin.radius();
|
auto diff = d - 2*bin.radius();
|
||||||
|
|
||||||
if(diff > 0) {
|
if(diff > 0) {
|
||||||
if( item.area() > 0.01*bin_area_ && item.vertexCount() < 20) {
|
if( item.area() > 0.01*bin_area_ && item.vertexCount() < 30) {
|
||||||
pile.emplace_back(item.transformedShape());
|
pile.emplace_back(item.transformedShape());
|
||||||
auto chull = ShapeLike::convexHull(pile);
|
auto chull = ShapeLike::convexHull(pile);
|
||||||
pile.pop_back();
|
pile.pop_back();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user