Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can you explain ADDpoint function?? #151

Open
leechangyo opened this issue Jul 29, 2021 · 1 comment
Open

can you explain ADDpoint function?? #151

leechangyo opened this issue Jul 29, 2021 · 1 comment

Comments

@leechangyo
Copy link

inline bool addPoint(DistanceType dist, IndexType index) {
CountType i;
for (i = count; i > 0; --i) {
#ifdef NANOFLANN_FIRST_MATCH // If defined and two points have the same
// distance, the one with the lowest-index will be
// returned first.
if ((dists[i - 1] > dist) ||
((dist == dists[i - 1]) && (indices[i - 1] > index))) {
#else
if (dists[i - 1] > dist) {
#endif
if (i < capacity) {
dists[i] = dists[i - 1];
indices[i] = indices[i - 1];
}
} else
break;
}
if (i < capacity) {
dists[i] = dist;
indices[i] = index;
}
if (count < capacity)
count++;

// tell caller that the search shall continue
return false;
// return true; 

}


if i turn it to false, time cost reduced , but result poor, but if it to true, result quality going up but time cost increased.

can you explain why??

@liwenz
Copy link

liwenz commented May 5, 2023

I try to learn:
/** Add points to the set, Inserts all points from [start, end] */
void addPoints(IndexType start, IndexType end)

I need to add a lots of points but control the least distance dist between every 2 points.
so every add, I need to check the dist then add

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants