Main Content

Insert or Remove Points in Delaunay Triangulation

Insert or remove points in Delaunay triangulation by using index-based subscripting. It is more efficient to edit a delaunayTriangulation to make minor modifications as opposed to recreating a new delaunayTriangulation from scratch, this is especially true if the data set is large.

Construct a Delaunay triangulation from 10 random points within a unit square.

rng default
x = rand(10,1);
y = rand(10,1);
dt = delaunayTriangulation(x,y)
dt = 
  delaunayTriangulation with properties:

              Points: [10×2 double]
    ConnectivityList: [11×3 double]
         Constraints: []

Insert 5 additional random points.

dt.Points(end+(1:5),:) = rand(5,2)
dt = 
  delaunayTriangulation with properties:

              Points: [15×2 double]
    ConnectivityList: [20×3 double]
         Constraints: []

Replace the fifth point.

dt.Points(5,:) = [0 0]
dt = 
  delaunayTriangulation with properties:

              Points: [15×2 double]
    ConnectivityList: [20×3 double]
         Constraints: []

Remove the fourth point.

dt.Points(4,:) = []
dt = 
  delaunayTriangulation with properties:

              Points: [14×2 double]
    ConnectivityList: [18×3 double]
         Constraints: []