Skip to content

Commit

Permalink
Fix neighborhood_points and neighborhood_indices
Browse files Browse the repository at this point in the history
Replace direct list initialization by direct initialization.

Fixes Issue #14.
  • Loading branch information
crvs authored Aug 20, 2024
1 parent 21d5a30 commit 0c15700
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions KDTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ pointIndexArr KDTree::neighborhood(point_t const& pt, double const& rad) {
pointVec KDTree::neighborhood_points(point_t const& pt, double const& rad) {
auto nbh = std::make_shared<pointIndexArr>();
neighborhood_(root_, pt, rad * rad, /*level*/ 0, *nbh);
pointVec nbhp{nbh->size()};
pointVec nbhp(nbh->size());
auto const first = [](pointIndex const& x) { return x.first; };
std::transform(nbh->begin(), nbh->end(), nbhp.begin(), first);
return nbhp;
Expand All @@ -285,7 +285,7 @@ pointVec KDTree::neighborhood_points(point_t const& pt, double const& rad) {
indexArr KDTree::neighborhood_indices(point_t const& pt, double const& rad) {
auto nbh = std::make_shared<pointIndexArr>();
neighborhood_(root_, pt, rad * rad, /*level*/ 0, *nbh);
indexArr nbhi{nbh->size()};
indexArr nbhi(nbh->size());
auto const second = [](pointIndex const& x) { return x.second; };
std::transform(nbh->begin(), nbh->end(), nbhi.begin(), second);
return nbhi;
Expand Down

0 comments on commit 0c15700

Please sign in to comment.