我已經實施decode/encode
方法將2d點轉化爲各自的morton code
。尋找最近的鄰居與莫頓代碼
我在尋找什麼是找到最近的鄰居(下min_distance
) 因此,例如,這樣的事情:
points=[(200,300),(500,150),(100,50)]
mortonCodes = {}
for p in points:
mortonCodes[encode(p)] = p
nearest = findNearestNeighbor(mortonCodes, (201,305))
print(nearest) # ---> should return (200,300)
這可能嗎?
是的,你是對的,我會upvote,因爲我不知道PH-Tree,我認爲這將是更好的解決方案! – greedsin
也有看看這個[回覆](http://stackoverflow.com/questions/4260002/benefits-of-nearest-neighbor-search-with-morton-order?rq=1),尤其是參考的評論kNN搜索的PDF與morton命令。 – TilmannZ