norlab-ulaval / libnabo

A fast K Nearest Neighbor library for low-dimensional spaces
http://norlab-ulaval.github.io/libnabo/
BSD 3-Clause "New" or "Revised" License
440 stars 144 forks source link

Requesting more points than available in cloud #108

Closed gsm-mgv closed 3 years ago

gsm-mgv commented 3 years ago

I'm getting the following spurious error when trying to use nabo:

terminate called after throwing an instance of 'std::runtime_error' what(): Requesting more points (1) than available in cloud (-4648799420485068736)

I'm effectively trying to (iteratively) perform a knn query within a class method, via a KD Tree that I have generated within the constructor for the class. The cloud that is being used to generate the KD tree is valid for the lifetime of the class; the point query matrix is also valid for the call to knn (I'm printing both of these out prior to check; they are a finite size, with valid values). Has anyone come across this before, or am I using nabo incorrectly?

gsm-mgv commented 3 years ago

It turns out that my use of a (fixed X dynamic) matrix as input to construct the KD Tree was causing an issue. Changing this to a (dynamic X dynamic) matrix appears to have solved it.