From 3c1f7f9e1660c91f94504ce0da9f0e48250a4744 Mon Sep 17 00:00:00 2001 From: Arthur Date: Thu, 27 Apr 2023 10:27:38 +0800 Subject: [PATCH] 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 --- src/libslic3r/SupportMaterial.cpp | 5 +++-- src/libslic3r/TreeSupport.cpp | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/libslic3r/SupportMaterial.cpp b/src/libslic3r/SupportMaterial.cpp index da76ea2f4..a0c4085ae 100644 --- a/src/libslic3r/SupportMaterial.cpp +++ b/src/libslic3r/SupportMaterial.cpp @@ -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; } } diff --git a/src/libslic3r/TreeSupport.cpp b/src/libslic3r/TreeSupport.cpp index cc3461367..22a694b1d 100644 --- a/src/libslic3r/TreeSupport.cpp +++ b/src/libslic3r/TreeSupport.cpp @@ -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