FIX: improve cantilever detection of tree support

github: #3667
Change-Id: I5fd6d7d5a6e80aaa563f7d033381e6b8cb9093e0
(cherry picked from commit 3f5fdf82dcaa8636d295794a1113aab78f7327af)
This commit is contained in:
Arthur 2024-03-07 09:26:48 +08:00 committed by Lane.Wei
parent 377756464e
commit 58bba45bc2
1 changed files with 3 additions and 1 deletions

View File

@ -799,6 +799,7 @@ void TreeSupport::detect_overhangs(bool check_support_necessity/* = false*/)
Layer* lower_layer = layer->lower_layer;
coordf_t lower_layer_offset = layer_nr < enforce_support_layers ? -0.15 * extrusion_width : (float)lower_layer->height / tan(threshold_rad);
//lower_layer_offset = std::min(lower_layer_offset, extrusion_width);
coordf_t support_offset_scaled = scale_(lower_layer_offset);
// Filter out areas whose diameter that is smaller than extrusion_width. Do not use offset2() for this purpose!
ExPolygons lower_polys;
@ -853,7 +854,8 @@ void TreeSupport::detect_overhangs(bool check_support_necessity/* = false*/)
// check cantilever
{
auto cluster_boundary_ex = intersection_ex(poly, offset_ex(lower_layer->lslices, scale_(0.5)));
// lower_layer_offset may be very small, so we need to do max and then add 0.1
auto cluster_boundary_ex = intersection_ex(poly, offset_ex(lower_layer->lslices, scale_(std::max(extrusion_width,lower_layer_offset)+0.1)));
Polygons cluster_boundary = to_polygons(cluster_boundary_ex);
if (cluster_boundary.empty()) continue;
double dist_max = 0;