jtsiomb / kdtree

A simple C library for working with KD-Trees
http://nuclear.mutantstargoat.com/sw/kdtree/
Other
395 stars 115 forks source link

Implementing the kd_nearest_n function #18

Open fbriol opened 7 years ago

fbriol commented 7 years ago

Hello, I needed to implement the function kd_nearest_n. It's up to you to see if it interests and suits you. Sincerely, F. Briol.

jtsiomb commented 7 years ago

Hi, Is it done? Could you send me an email with a short description of what you did, any references to the algorithm details etc? (nuclear@member.fsf.org).

I'll take a look at it as soon as possible.

ghost commented 7 years ago

The PR introduces a lot of style changes (in my view those would be best in their own PR), consequently the diffs are rather noisy. So could I suggest using GitHub's "whitespace change suppression" feature, just add ?w=1 to the URL, as here.

fbriol commented 7 years ago

Hello,

Sorry to respond to you so late, but I was AFK during my winter break.

The computation algorithm consists of managing a list of N nearest neighbors. When calculating a new distance during the descent of the tree, the new node is integrated when the distance found is less than the maximum distance stored on the list.

I also added a function to remove all the memory used during the calculation. Perhaps it would be desirable to add a new function performing this task so as not to change the previous behavior of your API.

To format the code, I used "clang-format" to standardize the formatting of the code. I can just introduce the changes without using this tool. But from my point of view, it's very useful to use such a tool, because you can sure that all contributions pushed will use the same formatting.

xJeffos commented 3 years ago

Hello !

Is there a plan to integrate this work ? @fbriol branch works quite well for me.

jtsiomb commented 3 years ago

Good to hear it works, but this was never merged because it's a terrible pull request. The OP used a code formatting tool which introduced style changes everywhere. Someone needs to clean this up and rebase it, to make a clean changeset out of this, reflecting only the true additions to the code, before it can be merged.