找到一个范围内的所有点到任意点的另一套范围内

由网友(他是我不能拥抱的太阳)分享简介:我有两个点集的 A 和 B 我想找到的 B 是在一定范围内的研究所有点为 A ,其中一个点的 B 中的 B 被说成是在范围之内的研究为 A 如果有至少一个点 在 A 的(欧几里德)距离为 B 等于或更小,河I want to find all points in B that are within a certa...

我有两个点集的 A 和 B

我想找到的 B 是在一定范围内的研究所有点为 A ,其中一个点的 B 中的 B 被说成是在范围之内的研究为 A 如果有至少一个点 在 A 的(欧几里德)距离为 B 等于或更小,河

I want to find all points in B that are within a certain range r to A, where a point b in B is said to be within range r to A if there is at least one point a in A whose (Euclidean) distance to b is equal or smaller to r.

每个的两组分的是一套连贯点。它们由两个非重叠的对象的体素位置处产生

Each of the both sets of points is a coherent set of points. They are generated from the voxel locations of two non overlapping objects.

在1D这个问题相当简单:对 B 在[分钟的所有点( A ) - 研究 MAX( A )+ 研究]

In 1D this problem fairly easy: all points of B within [min(A)-r max(A)+r]

不过,我在3D。

什么是做到这一点的最好方法是什么?

What is the best way to do this?

我目前重复搜索的每一个点的 A 中的 B 的范围内使用一些KNN算法(即MATLAB的rangesearch),然后所有点统一所有这些集。但我有一种感觉,应该有更好的方式来做到这一点。我想preFER在MATLAB较高水平/矢量化的解决方案,但是伪code是没关系:)

I currently repetitively search for every point in A all points in B that within range using some knn algorithm (ie. matlab's rangesearch) and then unite all those sets. But I got a feeling that there should be a better way to do this. I'd prefer a high level/vectorized solution in matlab, but pseudo code is fine too :)

我还以为写的所有的点图像,并使用图像膨胀对象A和R的半径。但是,这听起来像一个相当的开销。

I also thought of writing all the points to images and using image dilation on object A with a radius of r. But that sounds like quite an overhead.

推荐答案

您可以使用 kd树 来存储的所有点。

You can use a k-d tree to store all points of A.

迭代B点的B,并为每个点 - 找到最近点在甲(让它成为一)在kd树。 b点应包括在结果当且仅当距离 D(A,B)越小则研究

Iterate points b of B, and for each point - find the nearest point in A (let it be a) in the k-d tree. The point b should be included in the result if and only if the distance d(a,b) is smaller then r.

复杂性将是 O(| B | *日志(| A |)+ | A | *日志(| A |))

阅读全文

相关推荐

最新文章