From 1b54235d67ae8c1d49b14a821ff10a1c7e009c2a Mon Sep 17 00:00:00 2001 From: tamasmeszaros Date: Tue, 25 Oct 2022 13:34:56 +0200 Subject: [PATCH] connect_to_ground() now handles widening correctly --- src/libslic3r/SLA/SupportTreeUtils.hpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/libslic3r/SLA/SupportTreeUtils.hpp b/src/libslic3r/SLA/SupportTreeUtils.hpp index 38515f8793..983380d12b 100644 --- a/src/libslic3r/SLA/SupportTreeUtils.hpp +++ b/src/libslic3r/SLA/SupportTreeUtils.hpp @@ -558,8 +558,7 @@ bool optimize_pinhead_placement(Ex policy, m.cfg.head_back_radius_mm; // check available distance - Hit t = pinhead_mesh_hit(policy, m.emesh, hp, nn, pin_r, back_r, w, - sd); + Hit t = pinhead_mesh_hit(policy, m.emesh, hp, nn, pin_r, back_r, w, sd); if (t.distance() < w) { // Let's try to optimize this angle, there might be a @@ -663,11 +662,13 @@ std::pair connect_to_ground(Ex policy, return {false, SupportTreeNode::ID_UNSET}; Vec3d endp = hjp + d * dir; - auto ret = create_ground_pillar(policy, builder, sm, endp, dir, r, end_r); + double bridge_ratio = d / (d + (endp.z() - sm.emesh.ground_level())); + double pill_r = r + bridge_ratio * (end_r - r); + auto ret = create_ground_pillar(policy, builder, sm, endp, dir, pill_r, end_r); if (ret.second >= 0) { - builder.add_bridge(hjp, endp, r); - builder.add_junction(endp, r); + builder.add_diffbridge(hjp, endp, r, pill_r); + builder.add_junction(endp, pill_r); } return ret; @@ -687,9 +688,9 @@ std::pair search_ground_route(Ex policy, if (res.first) return res; - // Optimize bridge direction: - // Straight path failed so we will try to search for a suitable - // direction out of the cavity. + // Optimize bridge direction: + // Straight path failed so we will try to search for a suitable + // direction out of the cavity. auto [polar, azimuth] = dir_to_spheric(init_dir); Optimizer solver(get_criteria(sm.cfg).stop_score(1e6));