Skip to content

Commit 5ee42e8

Browse files
Shuffling points in ball query
1 parent 1ae0703 commit 5ee42e8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cpu/src/neighbors.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Taken from https://github.com/HuguesTHOMAS/KPConv
33

44
#include "neighbors.h"
5+
#include <random>
56

67
template <typename scalar_t>
78
int nanoflann_neighbors(vector<scalar_t>& queries, vector<scalar_t>& supports,
@@ -62,7 +63,12 @@ int nanoflann_neighbors(vector<scalar_t>& queries, vector<scalar_t>& supports,
6263
if (nMatches == 0)
6364
list_matches[i0] = {std::make_pair(0, -1)};
6465
else
66+
{
67+
std::random_device rd;
68+
std::mt19937 g(rd());
69+
std::shuffle(ret_matches.begin(), ret_matches.end(), g);
6570
list_matches[i0] = ret_matches;
71+
}
6672
max_count = max(max_count, nMatches);
6773
i0++;
6874
}

0 commit comments

Comments
 (0)