Accelerating the pace of engineering and science

# Documentation Center

• Trial Software

# delaunayTriangulation class

Superclasses: triangulation

Delaunay triangulation in 2-D and 3-D

## Description

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.

## Construction

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(P,C) specifies the edge constraints in matrix C. In this case, P specifies points in 2-D. Each row of C defines the start and end vertex IDs of a constrained edge.

DT = delaunayTriangulation(x,y) creates a 2-D Delaunay triangulation from the point coordinates in the column vectors, x and y.

DT = delaunayTriangulation(x,y,C) specifies the edge constraints in matrix C.

DT = delaunayTriangulation(x,y,z) creates a 3-D Delaunay triangulation from the point coordinates in the column vectors, x, y, and z.

DT = delaunayTriangulation() creates an empty Delaunay triangulation.

### Input Arguments

 P 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 x-coordinates vector, specified as a column vector containing the x-coordinates of the triangulation points. y y-coordinates vector, specified as a column vector containing the y-coordinates of the triangulation points. z z-coordinates vector, specified as a column vector containing the z-coordinates of the triangulation points. C Vertex IDs of constrained edges, specified as a 2-column matrix. Each row of C corresponds to a constrained edge and contains two IDs:C(j,1) is the ID of the vertex at the start of an edge.C(j,2) is the ID of the vertex at end of the edge.You can specify edge constraints for 2-D triangulations only.

## Properties

 Points Points in the triangulation, represented as a matrix containing the following information: Each row in DT.Points contains the coordinates of a vertex.Each row number of DT.Points is a vertex ID.
 ConnectivityList Triangulation connectivity list, represented as a matrix. This matrix contains the following information:Each row represents a triangle or tetrahedron in the triangulation.Each row number of DT.ConnectivityList is a Triangle or Tetrahedron ID.Each element is a vertex ID.
 Constraints 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(j,1) is the ID of the vertex at the start of an edge.DT.Constraints(j,2) is the ID of the vertex at end of the edge. DT.Constraints is an empty matrix when the triangulation has no constrained edges.

## Methods

 convexHull Convex hull 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 voronoiDiagram Voronoi diagram

### Inherited Methods

 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 edges Triangulation edges 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

## Definitions

### Delaunay Triangulation

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.

### Vertex ID

A row number of the matrix, DT.Points. Use this ID to refer a specific vertex in the triangulation.

### Triangle or Tetrahedron ID

A row number of the matrix, DT.ConnectivityList. Use this ID to refer a specific triangle or tetrahedron.

## Copy Semantics

Value. To learn how value classes affect copy operations, see Copying Objects in the MATLAB® documentation.

## Examples

expand all

### 2-D Delaunay Triangulation

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.

```figure
triplot(DT)
```

### 3-D Delaunay 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);
```