最快的最近邻居算法 [英] fastest nearest neighbor algorithm
问题描述
什么是找到最近点的数据数组给定点的最快方法?
What is the fastest way to find closest point to the given point in data array?
例如,我有3D空间,点阵列(坐标 - (X,Y,Z))和点(XP,YP,ZP)。 我需要找到最近点的(XP,YP,ZP)。
For example, I have 3D space, array of points (coordinates - (x,y,z)) and point (xp, yp,zp). I need to find closest point to the (xp, yp, zp).
据我所知,最慢要做到这一点的方法是使用线性搜索。有没有更好的办法呢?
As far as I know, slowest way to do it is to use linear search. Are there any better solutions?
加成任何辅助的数据是可能的。
Addition of any auxilary data is possible.
推荐答案
您可以组织你的观点在八叉树。然后,你只需要搜索的一小部分。
You may organize your points in an Octree. Then you only need to search a small subset.
请参阅: http://en.wikipedia.org/wiki/Octree
这是一个相当简单的数据结构,你可以实现你自己(这将是一个宝贵的学习经验),或者您可能会发现一些有用的库,让你去。
This is a fairly simple data structure you can implement yourself (which would be a valuable learning experience), or you may find some helpful libraries to get you going.
注:我原来是说四叉树(这是2D)的意外。感谢@marcog的修正。
Note: I originally said Quadtree (which is for 2D) by accident. Thanks @marcog for the correction.
这篇关于最快的最近邻居算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!