Finding the closest neighbouring coordinates in 3D

34 ビュー (過去 30 日間)
Deniz
Deniz 2019 年 3 月 20 日
回答済み: Rik 2019 年 3 月 20 日
Hello community,
The data I have is a matrix with X,Y,Z coordinates. I need to find the neighboring points in a mesh. For instance, the point N381 has the closest neighbors N380, N388, N382 and N374.
Capture.PNG
I was first thinking about comparing the coordinates one by one to each other and look for the minumums, but it feels like when I work on a large size matrix it will demand a lot of computation. Does anyone have an idea to proceed in a more practical way?
Best regards

採用された回答

Rik
Rik 2019 年 3 月 20 日
As suggested here, if you have the statistics toolbox, you can use the pdist function. If you have more structured data (e.g. a mesh), you could probably prevent having to calculate all inter-point distances. Note that you will 'only' have to call pdist once to calculate all distances.

その他の回答 (0 件)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by