MATLAB Answers

How to do this with Delaunay Triangulation?

16 views (last 30 days)
Levente Kis
Levente Kis on 26 Feb 2021
Commented: John D'Errico on 26 Feb 2021
I have X_0, Y_0 coordinates as column vectors and they can be plotted like in the following figure:
I am trying to create a Delaunay Triangulation with
DT = delaunayTriangulation(X_0,Y_0);
figure(1)
triplot(DT,'.-',"LineWidth",2,"MarkerSize",20);
and the result is the following:
As you can see there are many unnecessary lines and triangles in the circled area. What can I do to not have triangles in that area?
  1 Comment
John D'Errico
John D'Errico on 26 Feb 2021
What can you do? Don't use a delaunay triangulation. A delaunaytriangulation will result in a triangulation of the convex hull of the data. Those extra edges you see are a consequence of that.
You might try using a polyshape to describe the boundary of the region, as a non-convex polygon. Now use the triangulation method to form a triangulation of the domain.
Or, you might decide to form a constrained triangulation, where you force delaunayTriangulation to use specific edges. The result will still be convex. But now you can go in and delete the triangles with long edges.

Sign in to comment.

Answers (1)

Bjorn Gustavsson
Bjorn Gustavsson on 26 Feb 2021
You'll have to go through DT.ConnectivityList and remove the triangles you don't like. The function returns a convex set of triangles so the triangulation you got is what's to be expected. You might also automate this by checking the side-lengths of the triangles and discard those that have to long sides, if that's what you prefer.
HTH

Community Treasure Hunt

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

Start Hunting!

Translated by