From 4f9f1bbba05c8b9f98594f9c2c4740184eceff9e Mon Sep 17 00:00:00 2001 From: "jiaxi.chen" Date: Sat, 8 Feb 2025 14:37:27 +0800 Subject: [PATCH] FIX: useless expand for tree nodes jira: STUDIO-10235 Change-Id: I2a6780b4d010253452249c426437aba2bcc6ff60 --- src/libslic3r/Support/TreeSupport.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/libslic3r/Support/TreeSupport.cpp b/src/libslic3r/Support/TreeSupport.cpp index 6cb492e7b..452a4d62c 100644 --- a/src/libslic3r/Support/TreeSupport.cpp +++ b/src/libslic3r/Support/TreeSupport.cpp @@ -3743,18 +3743,23 @@ void TreeSupport::generate_contact_points() bool add_interface = (force_tip_to_roof || area(overhang_part) > minimum_roof_area); const auto &relevant_forbidden = get_collision(0, layer_nr - 1); ExPolygons overhangs{overhang_part}; - ExPolygons overhangs_regular; + ExPolygons overhangs_regular, overhangs_no_extra_expand; + if (add_interface && xy_expansion > EPSILON && !is_sharp_tail) { + overhangs = safe_offset_inc(overhangs, xy_expansion, relevant_forbidden, scale_(MIN_BRANCH_RADIUS * 1.75), 0, 1); + } + overhangs_no_extra_expand = (unscale_(xy_expansion) - config.support_expansion.value) > EPSILON ? + safe_offset_inc({overhang_part}, scale_(config.support_expansion.value), relevant_forbidden, scale_(MIN_BRANCH_RADIUS * 1.75), 0, 1) : + overhangs; if (m_support_params.support_style == smsTreeHybrid && (overhang_type & (BigFlat | ThinPlate))) { - if (add_interface && xy_expansion > EPSILON && !is_sharp_tail) { - overhangs = safe_offset_inc(overhangs, xy_expansion, relevant_forbidden, scale_(MIN_BRANCH_RADIUS * 1.75), 0, 1); - } overhangs_regular = offset_ex(intersection_ex(overhangs, m_ts_data->m_layer_outlines_below[layer_nr - 1]), radius_scaled); ExPolygons overhangs_normal = diff_ex(overhangs, overhangs_regular); + overhangs_regular = intersection_ex(overhangs_regular, overhangs_no_extra_expand); // if the outside area is still big, we can need normal nodes for (auto &overhang : overhangs_normal) { if (!is_stable(layer->bottom_z(), overhang, 0)) { - overhangs_regular.emplace_back(overhang); + ExPolygons unstable_overhangs = intersection_ex({overhang}, overhangs_no_extra_expand); + overhangs_regular.insert(overhangs_regular.end(), unstable_overhangs.begin(), unstable_overhangs.end()); continue; } BoundingBox overhang_bounds = get_extents(overhang); @@ -3766,8 +3771,7 @@ void TreeSupport::generate_contact_points() } } else{ - if (add_interface) overhangs = safe_offset_inc(overhangs, scale_(config.support_expansion.value), relevant_forbidden, scale_(MIN_BRANCH_RADIUS * 1.75), 0, 1); - overhangs_regular = overhangs; + overhangs_regular = overhangs_no_extra_expand; } for (auto &overhang : overhangs_regular) {