Matlab 2010b triangulation concave hull

Hi,
I am trying to perform Delaunay triangulation for this shape:
The problem is that as a result of triangulation I obtain mesh like this:
What I need is an alghoritm to find outer points to set them as a constraint for triangulation. I know that in Matlab 2014 "boundary.m" function was introduced which should do the job, but my question is, is it possible to obtain similar solution with Matlab 2010b?

回答(1 个)

No.
Your only solution there is to just test each triangle found. Check the length of each edge. Delete any triangles from the simplicial complex that have any edge longer than some constant. You know how long that maximum can be, since it would be simply twice the distance between any two points around the outer boundary. Any triangle with an edge that exceeds the limit must be spurious.
The nice thing is, the test is simple and fast, and trivially vectorized, done in only a couple of lines of code. Essentially you are doing a simple variation of an alpha shape.
xy = rand(10000,2)*[1 0;0 .5];
xy(sqrt((xy(:,1) - .5).^2 + (xy(:,2) - 0.55).^2) < 0.45,:) = [];
tri0 = delaunayn(xy);
trimesh(tri0,xy(:,1),xy(:,2))
maxEdge = 0.1;
tri = tri0;
edges = [tri(:,[1 2]);tri(:,[1 3]);tri(:,[2 3])];
tri(any(reshape(sqrt((xy(edges(:,1),1) - xy(edges(:,2),1)).^2 + (xy(edges(:,1),2) - xy(edges(:,2),2)).^2),[],3) > maxEdge,2),:) = [];
figure
trimesh(tri,xy(:,1),xy(:,2))
Really, it took more work to plot the figures than it did to excise the spare triangles.

1 个评论

Instead of using a fixed threshold value "maxEdge = 0.1;" you could save "sqrt((xy(edges(:,1),1) - xy(edges(:,2),1)).^2 + (xy(edges(:,1),2) - xy(edges(:,2),2)).^2)" into a variable and compute its median and stardard deviation to ellaborate a statistical-based threshold using the following expression: maxEdge = median+alpha*std, where alpha is a scalar ranging from 0 to 1.

请先登录,再进行评论。

类别

在 帮助中心 和 File Exchange 中查找有关 Triangulations 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by