Nearest neighbor search with periodic boundary conditions

前端 未结 2 1737
-上瘾入骨i
-上瘾入骨i 2021-02-05 23:08

In a cubic box I have a large collection points in R^3. I\'d like to find the k nearest neighbors for each point. Normally I\'d think to use something like a k-d tree, but in th

2条回答
  •  执念已碎
    2021-02-06 00:00

    Even in the Euclidean case, a point and its nearest neighbor may be on opposite sides of a hyperplane. The core of nearest-neighbor search in a k-d tree is a primitive that determines the distance between a point and a box; the only modification necessary for your case is to take the possibility of wraparound into account.

    Alternatively, you could implement cover trees, which work on any metric.

提交回复
热议问题