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

9 次查看(过去 30 天)
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