# DelaunayTri

(Not recommended) Delaunay triangulation in 2-D and 3-D

`DelaunayTri` is not recommended. Use `delaunayTriangulation` instead.

## Description

`DelaunayTri` creates a Delaunay triangulation object from a set of points. You can incrementally modify the triangulation by adding or removing points. In 2-D triangulations you can impose edge constraints. You can perform topological and geometric queries, and compute the Voronoi diagram and convex hull.

## Creation

### Syntax

``DT = DelaunayTri``
``DT = DelaunayTri(X)``
``DT = DelaunayTri(x,y)``
``````DT = DelaunayTri(x,y,z)``````
``DT = DelaunayTri(___,C)``

### Description

````DT = DelaunayTri` creates an empty Delaunay triangulation.```
````DT = DelaunayTri(X)`, `DT = DelaunayTri(x,y)` and ```DT = DelaunayTri(x,y,z)``` create a Delaunay triangulation from a set of points. The points can be specified as an `mpts`-by-`ndim` matrix `X`, where `mpts` is the number of points and `ndim` is the dimension of the space where the points reside (`ndim` is 2 or 3). Alternatively, the points can be specified as column vectors `(x,y)` or `(x,y,z)` for 2-D and 3-D input.```

example

````DT = DelaunayTri(___,C)` creates a constrained Delaunay triangulation. This feature is only supported for 2-D triangulations.```

### Input Arguments

expand all

Points to triangulate, specified as a matrix. `X` is an `mpts`-by-`ndim` matrix, where `mpts` is the number of points and `ndim` is the dimension of the space where the points reside (`ndim` is 2 or 3).

Points to triangulate, specified as separate vector arguments. Specify column vectors `(x,y)` or `(x,y,z)` for 2-D and 3-D input, respectively.

Edge constraints, specified as a matrix. The edge constraints `C` are defined by an `numc`-by-2 matrix, `numc` being the number of constrained edges. Each row of `C` defines a constrained edge in terms of its endpoint indices into the point set `X`.

## Properties

expand all

Vertex coordinates, specified as a matrix. The dimension of `X` is `mpts`-by-`ndim`, where `mpts` is the number of points and `ndim` is the dimension of the space where the points reside. If column vectors of `x`,`y` or `x`,`y`,`z` coordinates are used to construct the triangulation, the data is consolidated into a single matrix `X`.

Triangulation connectivity, specified as a matrix. `Triangulation` is a matrix representing the set of simplices (triangles, tetrahedra, and so on) that make up the triangulation. The matrix is of size `mtri`-by-`nv`, where `mtri` is the number of simplices and `nv` is the number of vertices per simplex. The triangulation is represented by standard simplex-vertex format; each row specifies a simplex defined by indices into `X`, where `X` is the array of point coordinates.

Constrained edges, specified as a matrix. `Constraints` is a `numc`-by-2 matrix that defines the constrained edge data in the triangulation, where `numc` is the number of constrained edges. Each constrained edge is defined in terms of its endpoint indices into `X`.

The constraints can be specified when the triangulation is constructed or can be imposed afterwards by directly editing the `Constraints` property.

This feature is only supported for 2-D triangulations.

## Object Functions

In addition to the below object functions, `DelaunayTri` objects support indexing into the triangulation using parentheses `()`. The syntax is the same as for arrays.

 `baryToCart` (Not recommended) Convert point coordinates from barycentric to Cartesian `cartToBary` (Not recommended) Convert point coordinates from Cartesian to barycentric `circumcenters` (Not recommended) Circumcenters of specified simplices `convexHull` (Not recommended) Convex hull of Delaunay triangulation `edgeAttachments` (Not recommended) Triangles or tetrahedra attached to specified edge `edges` (Not recommended) Triangulation edges `faceNormals` (Not recommended) Unit normals to specified triangles `featureEdges` (Not recommended) Sharp edges of surface triangulation `freeBoundary` (Not recommended) Free boundary facets `incenters` (Not recommended) Incenters of specified simplices `inOutStatus` (Not recommended) Status of triangles in 2-D constrained Delaunay triangulation `isEdge` (Not recommended) Test if vertices are joined by edge `nearestNeighbor` (Not recommended) Vertex closest to specified point `neighbors` (Not recommended) Triangle or tetrahedron neighbors `pointLocation` (Not recommended) Triangle or tetrahedron enclosing point `size` (Not recommended) Size of triangulation matrix `vertexAttachments` (Not recommended) Triangles or tetrahedra attached to vertex `voronoiDiagram` (Not recommended) Voronoi diagram of Delaunay triangulation

## Examples

collapse all

Compute the Delaunay triangulation of twenty random points located within a unit square and then plot the triangulation.

```rng default x = rand(20,1); y = rand(20,1); dt = DelaunayTri(x,y); triplot(dt)```

• `DelaunayTri` can produce incorrect or inconsistent results when boundary constraints intersect or overlap. To avoid this behavior, use constraints that form one or multiple closed boundaries that do not intersect or overlap.