diff --git a/src/libslic3r/BranchingTree/PointCloud.cpp b/src/libslic3r/BranchingTree/PointCloud.cpp index 96e8bfd24..35498f4c1 100644 --- a/src/libslic3r/BranchingTree/PointCloud.cpp +++ b/src/libslic3r/BranchingTree/PointCloud.cpp @@ -139,9 +139,9 @@ PointCloud::PointCloud(std::vector meshpts, , MESHPTS_BEGIN{m_bedpoints.size()} , LEAFS_BEGIN{MESHPTS_BEGIN + m_meshpoints.size()} , JUNCTIONS_BEGIN{LEAFS_BEGIN + m_leafs.size()} - , m_searchable_indices(JUNCTIONS_BEGIN, true) - , m_queue_indices(JUNCTIONS_BEGIN, UNQUEUED) - , m_reachable_cnt{JUNCTIONS_BEGIN} + , m_searchable_indices(JUNCTIONS_BEGIN + m_junctions.size(), true) + , m_queue_indices(JUNCTIONS_BEGIN + m_junctions.size(), UNQUEUED) + , m_reachable_cnt{JUNCTIONS_BEGIN + m_junctions.size()} , m_ktree{CoordFn{this}, LEAFS_BEGIN} // Only for bed and mesh points { for (size_t i = 0; i < m_bedpoints.size(); ++i) diff --git a/src/libslic3r/BranchingTree/PointCloud.hpp b/src/libslic3r/BranchingTree/PointCloud.hpp index d80f23946..d2072bee9 100644 --- a/src/libslic3r/BranchingTree/PointCloud.hpp +++ b/src/libslic3r/BranchingTree/PointCloud.hpp @@ -169,6 +169,8 @@ public: void mark_unreachable(size_t node_id) { + assert(node_id < m_searchable_indices.size()); + m_searchable_indices[node_id] = false; m_queue_indices[node_id] = UNQUEUED; --m_reachable_cnt; @@ -195,7 +197,7 @@ public: auto start_queue() { - auto ptsqueue = make_mutable_priority_queue( + auto ptsqueue = make_mutable_priority_queue( [this](size_t el, size_t idx) { m_queue_indices[el] = idx; }, ZCompareFn{this}); diff --git a/src/libslic3r/SLA/BranchingTreeSLA.cpp b/src/libslic3r/SLA/BranchingTreeSLA.cpp index b73c5eaae..3f3e99d8e 100644 --- a/src/libslic3r/SLA/BranchingTreeSLA.cpp +++ b/src/libslic3r/SLA/BranchingTreeSLA.cpp @@ -120,7 +120,7 @@ bool BranchingTreeBuilder::add_bridge(const branchingtree::Node &from, double fromR = get_radius(from), toR = get_radius(to); Beam beam{Ball{fromd, fromR}, Ball{tod, toR}}; auto hit = beam_mesh_hit(ex_tbb, m_sm.emesh, beam, - m_sm.cfg.head_back_radius_mm); + m_sm.cfg.safety_distance_mm); bool ret = hit.distance() > (tod - fromd).norm();