Talk:K-d tree: Difference between revisions
Content added Content deleted
(Reply to comment) |
No edit summary |
||
Line 135: | Line 135: | ||
: Hi Rdm. Thanks; I'm attempting to sign this post properly, we'll see what happens. :-> Even if de-dup'ing the points were a good idea (which would depend on the application in which one is using the k-d tree; it definitely would not be a good idea for my particular application), it wouldn't be a fix for this bug, because here the bug occurs even if two points share just a single coordinate; they don't have to share all of their coordinates. In other words, for 2-D data, the bug could be triggered by having points at (10,17) and (5, 17). You can't de-dup those. :-> --[[User:Bhaller|Bhaller]] ([[User talk:Bhaller|talk]]) 18:19, 15 August 2017 (UTC) |
: Hi Rdm. Thanks; I'm attempting to sign this post properly, we'll see what happens. :-> Even if de-dup'ing the points were a good idea (which would depend on the application in which one is using the k-d tree; it definitely would not be a good idea for my particular application), it wouldn't be a fix for this bug, because here the bug occurs even if two points share just a single coordinate; they don't have to share all of their coordinates. In other words, for 2-D data, the bug could be triggered by having points at (10,17) and (5, 17). You can't de-dup those. :-> --[[User:Bhaller|Bhaller]] ([[User talk:Bhaller|talk]]) 18:19, 15 August 2017 (UTC) |
||
== C++ Bug? == |
|||
Shouldn't the line: |
|||
root_ = make_tree(0, nodes_.size(), 0); |
|||
in the kdtree constructor be: |
|||
root_ = make_tree(0, nodes_.size()-1, 0); |
|||
As it is the following line in make_tree() reads off the end of the nodes array: |
|||
std::nth_element(&nodes_[begin], &nodes_[n], &nodes_[end], node_cmp(index)); |