Finding the distance between a large group of points from a plane

13 visualizaciones (últimos 30 días)
Hi All,
I have a large group of points scattered in front of a curtain-like wall in the 3D space. I want to find the distance of each points from the wall.
If the number of points was low, I could find the distance of each points using the least square method. In other words, I could calculate the eucleadian distance of each point from all points on the wall and then find the lowest one. However, in my problem, I have about 3 million points that are scattered in front of a wall with irregular surface that can be described using around one million points. So totally I need to calculate the distance for about 3*E12 times, which is not feasible.
Is there any image processing method by which I can find the closest point on the wall to each point in front of the wall? I mean visually we can locate a set of few points on the wall that are closest to each point in front of it. Can we do the same thing using the MATLAB image processing toolbox?
Many thanks in advance,
  2 comentarios
Walter Roberson
Walter Roberson el 16 de Dic. de 2019
Is the current-like wall a logical plane? Or is it wavy like is not uncommon in some curtains?
Memo Remo
Memo Remo el 16 de Dic. de 2019
Hi Walter, Thanks for the reply. No, the surface of the wall is highly irregular. No surface fit can be considered.

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 16 de Dic. de 2019
https://www.mathworks.com/help/stats/knnsearch.html knnsearch() between the wall points and the cloud points.
This does not compare each point to each other point, not under the circumstance that the points are low dimensional and that euclidean distance is being used: instead it builds an octree or equivalent for higher dimensions.
  2 comentarios
Memo Remo
Memo Remo el 16 de Dic. de 2019
Thanks a lot. I need to give it a try. I hope it works. Best
Image Analyst
Image Analyst el 16 de Dic. de 2019
How long does it take if you do this?
numPoints = 100;
xy1 = rand(3*numPoints, 2);
xy2 = rand(numPoints, 2)
tic
distances = pdist2(xy1, xy2);
toc
Gradually increase numPoints up to a million. I did 100000 on my slow computer and it tool almost 4 minutes.
But I think subsampling your data and using KNN like Walter suggested to estimate the nearby points is a good workaround that may be accurate enough for you.

Iniciar sesión para comentar.

Más respuestas (1)

Memo Remo
Memo Remo el 4 de Mzo. de 2020
Dear Walter and Image Analyst,
Thanks for your help. Walter's solution is very efficient.
I am trying to apply this method on a stl file. For some perticular purposes I need to know the mesh elements information listed as a report. Is there any method by which I can extract information including elements' size, their edges' size, the connectivity of triagles with each other and normal vectors on each elements from the stl file?
Thanks.

Community Treasure Hunt

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

Start Hunting!

Translated by