ENH: improve sharp detection for small regions

1. improve sharp detection for small regions.
   When the region is around 1 extrsion width, previous method may miss some sharp tails.
Now we reduce the width threshold to 0.1*extrusion_width for sharp
tails.
   When checking "nothing below", need to expand the poly a little. Example:
benchy.
2. improve is_support_necessary.
   Only popup warning for sharp tail and large cantilever (longer than 6mm).

Jira: STUDIO-2567
Change-Id: I5e977e7766b35409891d1b41e36278e3f07fa372
(cherry picked from commit c9d8a7c1c3bbd4367c7fc44408c67e5c534167f4)
This commit is contained in:
Arthur 2023-03-24 17:59:53 +08:00 committed by Lane.Wei
parent 6ddcc14577
commit 0c2ba2b0a2
5 changed files with 28 additions and 22 deletions

View file

@ -1638,8 +1638,8 @@ static inline ExPolygons detect_overhangs(
// 1. nothing below
// Check whether this is a sharp tail region.
// Should use lower_layer_expolys without any offset. Otherwise, it may missing sharp tails near the main body.
if (g_config_support_sharp_tails && overlaps({ expoly }, lower_layer_expolys)) {
is_sharp_tail = expoly.area() < area_thresh_well_supported && !offset_ex(expoly,-0.5*fw).empty();
if (g_config_support_sharp_tails && overlaps(offset_ex(expoly, 0.5 * fw), lower_layer_expolys)) {
is_sharp_tail = expoly.area() < area_thresh_well_supported && !offset_ex(expoly,-0.1*fw).empty();
}
if (is_sharp_tail) {
@ -2366,6 +2366,7 @@ PrintObjectSupportMaterial::MyLayersPtr PrintObjectSupportMaterial::top_contact_
if (layer->lower_layer == NULL) continue;
Layer* lower_layer = layer->lower_layer;
auto cluster_boundary = intersection(cluster.merged_overhangs_dilated, offset(lower_layer->lslices, scale_(0.5)));
if (cluster_boundary.empty()) continue;
double dist_max = 0;
Points cluster_pts;
for (auto& poly : cluster.merged_overhangs_dilated)