A 2D slice of a 3D point cloud or see if a point is in a boundary

조회 수: 8 (최근 30일)
Alec York
Alec York 2018년 2월 25일
댓글: Alec York 2018년 2월 25일
So I have a Large 3D point cloud that I can turn into a Delaunay triangulation or a trisurf/mesh or put a boundary or create a boundary around. Ideally I would like 2D slices of the triangulation or boundary that I can plot. However If that is not possible I would simply like to know if a point is in the boundary created by the boundary function.
Thank you for any help :)

답변 (1개)

John D'Errico
John D'Errico 2018년 2월 25일
편집: John D'Errico 2018년 2월 25일
You should understand that a Delaunay triangulation will have a convex result? The outer boundary of a delaunay triangulation is the convex hull of the point set.
So if your point cloud is not convex, than the delaunay triangulation might incorrectly predict if some points are "inside"?
For example,
xy = rand(1000,2);
xy(sqrt(sum((xy - [1 .5]).^2,2)) < 0.3 ,:) = [];
plot(xy(:,1),xy(:,2),'.')
So any tool that relies on a convex hull, OR a delaunay triangulation will fail to recognize that circular indentation on the right edge of the cloud.
I did post a tool called inhull some years ago on the file exchange. But it tool will fail to recognize non-convexity.
However, if you have a moderately recent MATLAB release (R2014b or later), you could use the alphaShape utility.
S = alphaShape(xy,.25)
S =
alphaShape with properties:
Points: [859×2 double]
Alpha: 0.25
HoleThreshold: 0
RegionThreshold: 0
inShape(S,[.5 .5;.9 .5])
ans =
2×1 logical array
1
0
plot(S)
alphaShape also works in 3-dimensions.
Of course, if your data really is convex, then a simple convex hull will suffice. In that case, inhull will suffice. Or a delaunay tessellation will do what you want.
T = delaunayn(xy);
tsearchn(xy,T,[.9 .5;1.9 .5])
ans =
126
NaN
So the first point was inside, the second outside the cloud.
Computing a 2-d slice of a 3-d tessellation takes some more work, but is doable.
  댓글 수: 1
Alec York
Alec York 2018년 2월 25일
Thank you :) For my code I will be inputting variable geometry to me it seems that it would be an easier option to make sure the input is convex than to try and do otherwise. Do you have any recommendations of where to start if I did want to try and compute a 2d slice?

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

카테고리

Help CenterFile Exchange에서 Point Cloud Processing에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by