Find list of closest points around a point in 3D space.

347 Views Asked by At

I have a list of points (x1,y1,z1) ...(xn,yn,zn). I have another point in this space, (X,Y,Z). I want to find a subset of the original points that form a boundary around (X,Y,Z). Or in other words, a list of points that are closest to (X,Y,Z) in all directions.

1

There are 1 best solutions below

0
On BEST ANSWER

This is quite easy if you have the right tools. As suggested by @Lexi, first choose the radius for the included points, call it $R_0$.

Next, establish a (column) vector $R$, as follows

$$ R=\sqrt{(X-x_n)^2+(Y-y_n)^2+(Z-z_n)^2} $$

Then form the logical vector

$$ I=R\le R_0 $$

The subset of $I$ for which $I=1$ (logical!) will give the indices of the points which you desire.

This is much more efficient than the brute force method of comparing one point at a time, especially for very large $n$. The above equations are literally the two statements you need to do this in Matlab.