Finding the closest neighbouring coordinates in 3D

9 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

Rik
Rik il 20 Mar 2019
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.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by