which data structure is appropriate to query “all points within distance d from point p”

前端 未结 6 1290
余生分开走
余生分开走 2020-12-08 11:53

I have a 3D pointcloud and I\'d like to efficiently query all points within distance d from an arbitrary point p (which is not necessarily part of the stored pointcloud)

6条回答
  •  时光说笑
    2020-12-08 12:12

    Well, it depends on what other uses you need for the data structure.

    You can have a list of distances from point p to other points, ordered by distance, and map these lists to the points with a hashmap.

    map:
    p1 -> [{p2, d12}, {p4, d14}, {p3, d13}]
    p2 -> ...
    ...
    

    You can look up the point in the map, and iterate the list until the distance is higher than required.

提交回复
热议问题