ENH: improve the support of blade-shape overhangs

1. reduce the gap between blade-shape overhang and support
   github: #3667
2. improve sharp tail detection of blade-shape overhangs by introducing
   lslices_extrudable.
   github: #2786, #3367
   jira: STUDIO-5065, STUDIO-6038

Change-Id: I4e899eace1aa28b100a6f4ce2b8d740c317f5530
(cherry picked from commit 08328b848e39c345b6c7b64021d1e0f04df24d08)
(cherry picked from commit 22056d5f7e7bef5574b53fc0453781cd365bf0e1)
This commit is contained in:
Arthur
2024-03-07 16:14:46 +08:00
committed by Noisyfox
parent c199730004
commit 107551f7b4
3 changed files with 37 additions and 38 deletions

View File

@@ -1412,6 +1412,7 @@ static inline ExPolygons detect_overhangs(
const coordf_t max_bridge_length = scale_(object_config.max_bridge_length.value);
const bool bridge_no_support = object_config.bridge_no_support.value;
const coordf_t xy_expansion = scale_(object_config.support_expansion.value);
float lower_layer_offset = 0;
if (layer_id == 0)
{
@@ -1424,7 +1425,7 @@ static inline ExPolygons detect_overhangs(
!(bbox_size.x() > length_thresh_well_supported && bbox_size.y() > length_thresh_well_supported))
{
layer.sharp_tails.push_back(slice);
layer.sharp_tails_height.insert({ &slice, layer.height });
layer.sharp_tails_height.push_back(layer.height);
}
}
}
@@ -1444,7 +1445,6 @@ static inline ExPolygons detect_overhangs(
}
}
float lower_layer_offset = 0;
for (LayerRegion *layerm : layer.regions()) {
// Extrusion width accounts for the roundings of the extrudates.
// It is the maximum widh of the extrudate.
@@ -1506,7 +1506,7 @@ static inline ExPolygons detect_overhangs(
if (is_sharp_tail) {
ExPolygons overhang = diff_ex({ expoly }, lower_layer_expolys);
layer.sharp_tails.push_back(expoly);
layer.sharp_tails_height.insert({ &expoly, accum_height });
layer.sharp_tails_height.push_back(accum_height);
overhang = offset_ex(overhang, 0.05 * fw);
polygons_append(diff_polygons, to_polygons(overhang));
}
@@ -1546,7 +1546,7 @@ static inline ExPolygons detect_overhangs(
if (layer.lower_layer) {
for (ExPolygon& poly : overhang_areas) {
float fw = float(layer.regions().front()->flow(frExternalPerimeter).scaled_width());
auto cluster_boundary_ex = intersection_ex(poly, offset_ex(layer.lower_layer->lslices, scale_(0.5)));
auto cluster_boundary_ex = intersection_ex(poly, offset_ex(layer.lower_layer->lslices, std::max(fw, lower_layer_offset) + scale_(0.1)));
Polygons cluster_boundary = to_polygons(cluster_boundary_ex);
if (cluster_boundary.empty()) continue;
double dist_max = 0;
@@ -2216,9 +2216,9 @@ SupportGeneratorLayersPtr PrintObjectSupportMaterial::top_contact_layers(
}
// 2.3 check whether sharp tail exceed the max height
for (const auto& lower_sharp_tail_height : lower_layer_sharptails_height) {
if (lower_sharp_tail_height.first->overlaps(expoly)) {
accum_height += lower_sharp_tail_height.second;
for (size_t i = 0; i < lower_layer_sharptails_height.size();i++) {
if (lower_layer_sharptails[i].overlaps(expoly)) {
accum_height += lower_layer_sharptails_height[i];
break;
}
}
@@ -2243,7 +2243,7 @@ SupportGeneratorLayersPtr PrintObjectSupportMaterial::top_contact_layers(
if (is_sharp_tail) {
ExPolygons overhang = diff_ex({ expoly }, lower_layer->lslices);
layer->sharp_tails.push_back(expoly);
layer->sharp_tails_height.insert({ &expoly, accum_height });
layer->sharp_tails_height.push_back( accum_height );
append(overhangs_per_layers[layer_nr], overhang);
#ifdef SUPPORT_TREE_DEBUG_TO_SVG
SVG svg(get_svg_filename(std::to_string(layer->print_z), "sharp_tail"), object.bounding_box());