diff options
author | Arnur Nigmetov <a.nigmetov@gmail.com> | 2018-06-19 21:49:23 +0200 |
---|---|---|
committer | Arnur Nigmetov <a.nigmetov@gmail.com> | 2018-06-19 21:49:23 +0200 |
commit | 4e3fcd2f8596f39b9bff8cdd8d9789fdffe8a49c (patch) | |
tree | 56c7c5853f8ca015ca2d04758991262a716fc944 /geom_bottleneck/include/dnn/local/kd-tree.hpp | |
parent | a9d06f12ecbaa055d17970e09827ea7b67d1f53c (diff) |
Longest edge for bottleneck, tests for bottleneck
Diffstat (limited to 'geom_bottleneck/include/dnn/local/kd-tree.hpp')
-rw-r--r-- | geom_bottleneck/include/dnn/local/kd-tree.hpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/geom_bottleneck/include/dnn/local/kd-tree.hpp b/geom_bottleneck/include/dnn/local/kd-tree.hpp index 249fa55..5b84eb0 100644 --- a/geom_bottleneck/include/dnn/local/kd-tree.hpp +++ b/geom_bottleneck/include/dnn/local/kd-tree.hpp @@ -106,11 +106,11 @@ hera::bt::dnn::KDTree<T>::OrderTree size_t next_i = (i + 1) % traits.dimension(); // Replace with a size condition instead? - if (b < m - 1) + if (m - b > 1) q.push(KDTreeNode(b, m, im, next_i)); else if (b < m) tree->parents_[im - 1] = im; - if (e > m + 2) + if (e - m > 2) q.push(KDTreeNode(m+1, e, im, next_i)); else if (e > m + 1) tree->parents_[im + 1] = im; @@ -210,7 +210,7 @@ void hera::bt::dnn::KDTree<T>::search(PointHandle q, ResultsFunctor& rf) const DistanceType diffToWasserPower = (diff > 0 ? 1.0 : -1.0) * fabs(diff); size_t lm = m + 1 + (e - (m+1))/2 - tree_.begin(); - if ( subtree_n_elems[lm] > 0 ) { + if ( e > m + 1 and subtree_n_elems[lm] > 0 ) { if (e > m + 1 && diffToWasserPower >= -D) { nodes.push(KDTreeNode(m+1, e, i)); } |