ENH: increase top_area_threshold to 200%

100% is too small and causes too many problems.

jira: STUDIO-9641
Change-Id: I7699a31beea24d079c7ef05467a5d0fde4d6911b
This commit is contained in:
Arthur 2025-01-15 10:32:02 +08:00 committed by lane.wei
parent eeb474d2ce
commit 519ceaad5a
3 changed files with 9 additions and 14 deletions

View File

@ -9565,10 +9565,8 @@ msgstr "最顶面"
msgid "Top area threshold"
msgstr "顶部区域阈值"
msgid ""
"This factor affects the acreage of top area. The small the number the big "
"the top area."
msgstr "这个参数影响顶部区域的面积,值越大顶部区域越小"
msgid "The min width of top areas in percentage of perimeter line width."
msgstr "顶部区域的最小宽度,单位是墙线宽的百分比。"
msgid "Only one wall on first layer"
msgstr "首层仅单层墙"

View File

@ -1432,7 +1432,7 @@ void PerimeterGenerator::process_classic()
else
offset_top_surface = 0;
//don't takes into account too thin areas
double min_width_top_surface = (this->object_config->top_area_threshold / 100) * std::max(double(ext_perimeter_spacing / 2 + 10), 1.0 * (double(perimeter_width)));
double min_width_top_surface = (this->object_config->top_area_threshold / 100) * std::max(ext_perimeter_spacing / 2.0, perimeter_width / 2.0);
//BBS: get boungding box of last
BoundingBox last_box = get_extents(last);
@ -1885,8 +1885,6 @@ void PerimeterGenerator::process_arachne()
top_expolys_by_one_wall = diff_ex(top_expolys_by_one_wall, bottom_expolys);
seperate_wall_generation = should_enable_top_one_wall(last, top_expolys_by_one_wall);
if (seperate_wall_generation)
top_expolys_by_one_wall = offset_ex(top_expolys_by_one_wall, perimeter_width);
}
@ -2141,17 +2139,16 @@ void PerimeterGenerator::process_arachne()
}
}
// determine whether to enable top one wall feature
// expand the top expoly and determine whether to enable top one wall feature
bool PerimeterGenerator::should_enable_top_one_wall(const ExPolygons& original_expolys, ExPolygons& top)
{
coord_t perimeter_width = this->perimeter_flow.width();
coord_t perimeter_width = this->perimeter_flow.scaled_width();
coord_t ext_perimeter_spacing = this->ext_perimeter_flow.scaled_spacing();
//BBS: filter small area and extend top surface a bit to hide the wall line
double min_width_top_surface = (this->object_config->top_area_threshold / 100) * std::max(double(ext_perimeter_spacing / 4 + 10), double(perimeter_width / 4));
double min_width_top_surface = (this->object_config->top_area_threshold / 100) * std::max(ext_perimeter_spacing / 2.0, perimeter_width / 2.0);
top = offset2_ex(top, -min_width_top_surface, min_width_top_surface + perimeter_width);
// compare the width with the width of perimeter
return !offset_ex(top, -perimeter_width).empty();
return !top.empty();
}
bool PerimeterGeneratorLoop::is_internal_contour() const

View File

@ -1004,12 +1004,12 @@ void PrintConfigDef::init_fff_params()
def = this->add("top_area_threshold", coPercent);
def->label = L("Top area threshold");
def->tooltip = L("This factor affects the acreage of top area. The small the number the big the top area.");
def->tooltip = L("The min width of top areas in percentage of perimeter line width.");
def->sidetext = "%";
def->min = 0;
def->max = 500;
def->mode = comDevelop;
def->set_default_value(new ConfigOptionPercent(100));
def->set_default_value(new ConfigOptionPercent(200));
def = this->add("only_one_wall_first_layer", coBool);
def->label = L("Only one wall on first layer");