ENH: improve small overhang detection

Small overhang diameter threshold is reduced,
and use bounding box size instead of area for final decision.

Github: issue 1681
Change-Id: Iabbb49dfc47345bb609214749104c808608c4d65
This commit is contained in:
Arthur 2023-04-27 10:27:38 +08:00 committed by Lane.Wei
parent 6f2839b641
commit 3c1f7f9e16
2 changed files with 8 additions and 4 deletions

View file

@ -2379,8 +2379,9 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
if (!cluster.is_sharp_tail && !cluster.is_cantilever) {
// 2. check overhang cluster size is small
cluster.is_small_overhang = false;
auto erode1 = offset_ex(cluster.merged_overhangs_dilated, -2.5 * fw_scaled);
if (area(erode1) < SQ(scale_(0.1))) {
auto erode1 = offset_ex(cluster.merged_overhangs_dilated, -1.0 * fw_scaled);
Point bbox_sz = get_extents(erode1).size();
if (bbox_sz.x() < 2 * fw_scaled || bbox_sz.y() < 2 * fw_scaled) {
cluster.is_small_overhang = true;
}
}

View file

@ -1059,8 +1059,11 @@ void TreeSupport::detect_overhangs(bool detect_first_sharp_tail_only)
if (!cluster.is_sharp_tail && !cluster.is_cantilever) {
// 2. check overhang cluster size is smaller than 3.0 * fw_scaled
auto erode1 = offset_ex(cluster.merged_poly, -1.5 * extrusion_width_scaled);
cluster.is_small_overhang = area(erode1) < SQ(scale_(0.1));
auto erode1 = offset_ex(cluster.merged_poly, -1 * extrusion_width_scaled);
Point bbox_sz = get_extents(erode1).size();
if (bbox_sz.x() < 2 * extrusion_width_scaled || bbox_sz.y() < 2 * extrusion_width_scaled) {
cluster.is_small_overhang = true;
}
}
#ifdef SUPPORT_TREE_DEBUG_TO_SVG