diff --git a/src/libslic3r/SLA/SLASupportTreeBuilder.hpp b/src/libslic3r/SLA/SLASupportTreeBuilder.hpp index e967f5ea7..5ab42fa07 100644 --- a/src/libslic3r/SLA/SLASupportTreeBuilder.hpp +++ b/src/libslic3r/SLA/SLASupportTreeBuilder.hpp @@ -208,6 +208,11 @@ struct Bridge { const Vec3d &j2, double r_mm = 0.8, size_t steps = 45); + + Bridge(const Head &h, + const Vec3d &j2, + size_t steps = 45) + : Bridge{h.junction_point(), j2, h.r_back_mm, steps} {} }; // A bridge that spans from model surface to model surface with small connecting @@ -378,9 +383,23 @@ public: return m_junctions.back(); } - template const Bridge& add_bridge(Args&&... args) + template const Bridge& + add_bridge(const Vec3d &sp, const Vec3d &ep, double r, size_t steps = 45) { - return _add_bridge(m_bridges, std::forward(args)...); + return _add_bridge(m_bridges, sp, ep, r, steps); + } + + template + const Bridge& add_bridge(const Head &h, const Vec3d &endp, size_t steps = 45) + { + std::lock_guard lk(m_mutex); + m_bridges.emplace_back(h, endp, steps); + m_bridges.back().id = long(m_bridges.size() - 1); + + assert(h.id >= 0 && h.id < m_head_indices.size()); + m_heads[m_head_indices[size_t(h.id)]].bridge_id = m_bridges.back().id; + m_meshcache_valid = false; + return m_bridges.back(); } template const Bridge& add_crossbridge(Args&&... args) diff --git a/src/libslic3r/SLA/SLASupportTreeBuildsteps.cpp b/src/libslic3r/SLA/SLASupportTreeBuildsteps.cpp index 0ff26b3ac..50571c11e 100644 --- a/src/libslic3r/SLA/SLASupportTreeBuildsteps.cpp +++ b/src/libslic3r/SLA/SLASupportTreeBuildsteps.cpp @@ -582,7 +582,7 @@ void SupportTreeBuildsteps::create_ground_pillar(const Vec3d &jp, // the ground level only. normal_mode = false; - double mind = min_dist - dist; + double mind = min_dist - dist; double azimuth = std::atan2(sourcedir(Y), sourcedir(X)); double sinpolar = std::sin(PI - m_cfg.bridge_slope); double cospolar = std::cos(PI - m_cfg.bridge_slope); @@ -964,12 +964,11 @@ void SupportTreeBuildsteps::routing_to_model() auto routedown = [this](Head& head, const Vec3d& dir, double dist) { head.transform(); - Vec3d hjp = head.junction_point(); - Vec3d endp = hjp + dist * dir; - m_builder.add_bridge(hjp, endp, head.r_back_mm); + Vec3d endp = head.junction_point() + dist * dir; + m_builder.add_bridge(head, endp); m_builder.add_junction(endp, head.r_back_mm); - this->create_ground_pillar(endp, dir, head.r_back_mm, head.id); + this->create_ground_pillar(endp, dir, head.r_back_mm); }; std::vector modelpillars;