Finding the closest neighbouring coordinates in 3D

10 visualizaciones (últimos 30 días)
Deniz
Deniz el 20 de Mzo. de 2019
Respondida: Rik el 20 de Mzo. de 2019
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

Respuesta aceptada

Rik
Rik el 20 de Mzo. de 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.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by