主要内容

地图的有约束德劳内三角剖分

使用美国的周长地图创建一个有约束德劳内三角剖分。

加载美国本土的周长地图。

load usapolygon

在构成多边形边界的两个连续点之间定义一个边约束,并创建德劳内三角剖分。该三角剖分跨受点集的凸包约束的一个域。该数据集包含重复的数据点;即两个或更多个数据点的位置相同。重复的点将被拒绝,delaunayTriangulation 会相应地重新设置约束的格式。

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.

过滤出多边形域内的三角形并对其绘图。

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.