Delaunay triangulation in 2-D and 3-D
Use the delaunayTriangulation class to create a 2-D or 3-D triangulation from a set of points. When your points are in 2-D, you can specify edge constraints .
You can perform a variety of topological and geometric queries on a delaunayTriangulation, including any triangulation query. For example, locate a facet that contains a specific point, find the vertices of the convex hull, or compute the Voronoi Diagram.
DT = delaunayTriangulation(P) creates a Delaunay triangulation from the points in P. Matrix P has 2 or 3 columns, depending on whether your points are in 2-D or 3-D space.
DT = delaunayTriangulation() creates an empty Delaunay triangulation.
Input points, specified as a matrix whose columns are the x, y, (and possibly z) coordinates of the triangulation points. The row numbers of P are the vertex IDs in the triangulation.
x-coordinates vector, specified as a column vector containing the x-coordinates of the triangulation points.
y-coordinates vector, specified as a column vector containing the y-coordinates of the triangulation points.
z-coordinates vector, specified as a column vector containing the z-coordinates of the triangulation points.
Vertex IDs of constrained edges, specified as a 2-column matrix. Each row of C corresponds to a constrained edge and contains two IDs:
You can specify edge constraints for 2-D triangulations only.
Points in the triangulation, represented as a matrix containing the following information:
Triangulation connectivity list, represented as a matrix. This matrix contains the following information:
Constrained edges, represented as a two-column matrix of vertex IDs. Each row of DT.Constraints corresponds to a constrained edge and contains two IDs:
DT.Constraints is an empty matrix when the triangulation has no constrained edges.
|isInterior||Test if triangle is in interior of 2-D constrained Delaunay triangulation|
|nearestNeighbor||Vertex closest to specified location|
|pointLocation||Triangle or tetrahedron containing specified location|
|barycentricToCartesian||Converts point coordinates from barycentric to Cartesian|
|cartesianToBarycentric||Converts point coordinates from Cartesian to barycentric|
|circumcenter||Circumcenter of triangle or tetrahedron|
|edgeAttachments||Triangles or tetrahedra attached to specified edge|
|faceNormal||Triangulation face normal|
|featureEdges||Triangulation sharp edges|
|freeBoundary||Triangulation facets referenced by only one triangle or tetrahedron|
|incenter||Incenter of triangle or tetrahedron|
|isConnected||Test if two vertices are connected by edge|
|neighbors||Neighbors to specified triangle or tetrahedron|
|size||Size of triangulation connectivity list|
|vertexAttachments||Triangles or tetrahedra attached to specified vertex|
|vertexNormal||Triangulation vertex normal|
In a 2-D Delaunay triangulation, the circumcircle associated with each triangle does not contain any points in its interior. Similarly, a 3-D Delaunay triangulation does not have any points in the interior of the circumsphere associated with each tetrahedron. This definition extends to N-D, although delaunayTriangulation supports only 2-D and 3-D.
A row number of the matrix, DT.Points. Use this ID to refer a specific vertex in the triangulation.
A row number of the matrix, DT.ConnectivityList. Use this ID to refer a specific triangle or tetrahedron.
Value. To learn how value classes affect copy operations, see Copying Objects in the MATLAB® documentation.
Create a 2-D delaunayTriangulation for 30 random points.
P = gallery('uniformdata',[30 2],0); DT = delaunayTriangulation(P)
DT = delaunayTriangulation with properties: Points: [30x2 double] ConnectivityList: [50x3 double] Constraints: 
Plot the triangulation.
Create a 3-D delaunayTriangulation for 30 random points.
x = gallery('uniformdata',[30 1],0); y = gallery('uniformdata',[30 1],1); z = gallery('uniformdata',[30 1],2); DT = delaunayTriangulation(x,y,z)
DT = delaunayTriangulation with properties: Points: [30x3 double] ConnectivityList: [111x4 double] Constraints: 
Plot the triangulation at 30% opacity with a light blue face color.
faceColor = [0.6875 0.8750 0.8984]; figure tetramesh(DT,'FaceColor',faceColor,'FaceAlpha',0.3);