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

조회 수: 8 (최근 30일)
Memo Remo
Memo Remo 2019년 12월 16일
답변: Memo Remo 2020년 3월 4일
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
Walter Roberson
Walter Roberson 2019년 12월 16일
Is the current-like wall a logical plane? Or is it wavy like is not uncommon in some curtains?
Memo Remo
Memo Remo 2019년 12월 16일
Hi Walter, Thanks for the reply. No, the surface of the wall is highly irregular. No surface fit can be considered.

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2019년 12월 16일
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
Memo Remo
Memo Remo 2019년 12월 16일
Thanks a lot. I need to give it a try. I hope it works. Best
Image Analyst
Image Analyst 2019년 12월 16일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Memo Remo
Memo Remo 2020년 3월 4일
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.

카테고리

Help CenterFile Exchange에서 Interpolation of 2-D Selections in 3-D Grids에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by