Fix some crashes

Fix minor bugs
This commit is contained in:
tamasmeszaros 2022-06-09 11:18:19 +02:00
parent 688c9c644f
commit 95374f9ed4
3 changed files with 7 additions and 5 deletions

View File

@ -139,9 +139,9 @@ PointCloud::PointCloud(std::vector<Node> meshpts,
, MESHPTS_BEGIN{m_bedpoints.size()} , MESHPTS_BEGIN{m_bedpoints.size()}
, LEAFS_BEGIN{MESHPTS_BEGIN + m_meshpoints.size()} , LEAFS_BEGIN{MESHPTS_BEGIN + m_meshpoints.size()}
, JUNCTIONS_BEGIN{LEAFS_BEGIN + m_leafs.size()} , JUNCTIONS_BEGIN{LEAFS_BEGIN + m_leafs.size()}
, m_searchable_indices(JUNCTIONS_BEGIN, true) , m_searchable_indices(JUNCTIONS_BEGIN + m_junctions.size(), true)
, m_queue_indices(JUNCTIONS_BEGIN, UNQUEUED) , m_queue_indices(JUNCTIONS_BEGIN + m_junctions.size(), UNQUEUED)
, m_reachable_cnt{JUNCTIONS_BEGIN} , m_reachable_cnt{JUNCTIONS_BEGIN + m_junctions.size()}
, m_ktree{CoordFn{this}, LEAFS_BEGIN} // Only for bed and mesh points , m_ktree{CoordFn{this}, LEAFS_BEGIN} // Only for bed and mesh points
{ {
for (size_t i = 0; i < m_bedpoints.size(); ++i) for (size_t i = 0; i < m_bedpoints.size(); ++i)

View File

@ -169,6 +169,8 @@ public:
void mark_unreachable(size_t node_id) void mark_unreachable(size_t node_id)
{ {
assert(node_id < m_searchable_indices.size());
m_searchable_indices[node_id] = false; m_searchable_indices[node_id] = false;
m_queue_indices[node_id] = UNQUEUED; m_queue_indices[node_id] = UNQUEUED;
--m_reachable_cnt; --m_reachable_cnt;
@ -195,7 +197,7 @@ public:
auto start_queue() auto start_queue()
{ {
auto ptsqueue = make_mutable_priority_queue<size_t, false>( auto ptsqueue = make_mutable_priority_queue<size_t, true>(
[this](size_t el, size_t idx) { m_queue_indices[el] = idx; }, [this](size_t el, size_t idx) { m_queue_indices[el] = idx; },
ZCompareFn{this}); ZCompareFn{this});

View File

@ -120,7 +120,7 @@ bool BranchingTreeBuilder::add_bridge(const branchingtree::Node &from,
double fromR = get_radius(from), toR = get_radius(to); double fromR = get_radius(from), toR = get_radius(to);
Beam beam{Ball{fromd, fromR}, Ball{tod, toR}}; Beam beam{Ball{fromd, fromR}, Ball{tod, toR}};
auto hit = beam_mesh_hit(ex_tbb, m_sm.emesh, beam, 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(); bool ret = hit.distance() > (tod - fromd).norm();