필터 지우기
필터 지우기

Distance between a point(x,y,z) and a surface(X,Y,Z)

조회 수: 45 (최근 30일)
Aurea94
Aurea94 2021년 3월 22일
편집: Ali Grysah 2021년 4월 2일
I am trying to calculate the minimum distance between a point(x,y,z) and a surface defined by points (X;Y,Z). I now the normal to the point (x,y,z) from which I want to calculate distance, however I am not able to figure out the way of interpolating my surface so that the minimum distance is obtained, no matter the number of points in my surface.
Right now my option is to calcualte the distance from my point (x,y,z) to all the points in surface (X,Y,Z) and keep just the smallest one. However, I think there must be a better way of doing so.
Thank you very much for your help.
  댓글 수: 3
Aurea94
Aurea94 2021년 3월 22일
It should be D0 precise. For the moment with the simplification I am doing I know I am calculating D1.
Ali Grysah
Ali Grysah 2021년 4월 2일
편집: Ali Grysah 2021년 4월 2일
hi i need matlab 2008 windos7 /.bt32
can you help me,,and thunks

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

채택된 답변

darova
darova 2021년 3월 23일
편집: darova 2021년 3월 23일
THe best idea i have: refine close region using interp2 and just find closest distance (blue)
  댓글 수: 1
Aurea94
Aurea94 2021년 3월 23일
Thank you very much! I think it is the best option I can get!

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

추가 답변 (1개)

David Hill
David Hill 2021년 3월 22일
Seems like a math question rather than a Matlab question. The minnum distance between a plane and a point is just the absolute value of the dot product between the point and the unit normal vector of the plane. The normal vector of the plane can be easily found with the 3 points given and is just the cross product between two vectors lying in the plane. For example:
p=[1 -2 0;0 -1 2;3 1 4];%three points given on the plane
d=diff(p);%two vectors lying in the plane
N=cross(d(1,:),d(2,:));
n=N/norm(N);%unit normal vector of plane
You do the rest
  댓글 수: 3
Star Strider
Star Strider 2021년 3월 22일
Perhaps the surfnorm functon could be helpful?
Aurea94
Aurea94 2021년 3월 23일
Thats a good option I didn't knw t obtain surface normals! Thanks

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

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by