Using Google's C KD Tree Library

我与影子孤独终老i 提交于 2019-12-11 10:32:43

问题


Google has a KD Tree Library written in C: Here

As far as I can tell, you insert notes into the tree using one of it's functions, and then query the tree for nearest neighbors. It returns a pointer to a new array (as far as I can tell).

Here is my goal:

I have a 3D array and I am hoping to find a way to return the index of a given point's nearest neighbor. I want to say: Here is a point: (12,23,14), now tell me the index of the point that is closest ex: "it is the 5th item in your array". However, I am not sure how to do this.

My Questions, Does anyone:

A) Know of a good well documented k dimensional nearest neighbor search library for c, or:

B) Know how to get Google's code to return the position of the nearest neighbor in an array.


回答1:


The library you linked, from my understanding does not have the n-nearest neighbour search functions implemented. I don't have any other kd-tree library in mind for C.

Implementing a simple kd-tree is not very complex and it should be a good exercise. You could for example follow http://ldots.org/kdtree/ .



来源:https://stackoverflow.com/questions/14205971/using-googles-c-kd-tree-library

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!