Main Content

Constrained Delaunay Triangulation of Geographical Map

Create a constrained Delaunay triangulation using a map of the perimeter of the United States.

Load a map of the perimeter of the conterminous United States.

load usapolygon

Define an edge constraint between two successive points that make up the polygonal boundary and create the Delaunay triangulation. This triangulation spans a domain that is bounded by the convex hull of the set of points. The data set contains duplicate data points; that is, two or more data points have the same location. The duplicate points are rejected and the delaunayTriangulation re-formats the constraints accordingly.

nump = numel(uslon);
C = [(1:(nump-1))' (2:nump)'; nump 1];
dt = delaunayTriangulation(uslon,uslat,C);
Warning: Duplicate data points have been detected and removed.
 The Triangulation indices and constraints are defined with respect to the unique set of points in delaunayTriangulation.
Warning: Intersecting edge constraints have been split, this may have added new points into the triangulation.

Filter out the triangles that are within the domain of the polygon and plot them.

io = isInterior(dt);
patch(Faces=dt(io,:),Vertices=dt.Points,FaceColor="r")
axis equal
axis([-130 -60 20 55])
title("Constrained Delaunay Triangulation of usapolygon")

Figure contains an axes object. The axes object with title Constrained Delaunay Triangulation of usapolygon contains an object of type patch.