Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

delaunayTriangulation

Delaunay triangulation in 2-D and 3-D

Description

Use the delaunayTriangulation object to create a 2-D or 3-D Delaunay 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.

Creation

To create a delaunayTriangulation object, use the delaunayTriangulation function with input arguments that define the triangulation's points and constrained edges.

Syntax

DT = delaunayTriangulation(P)
DT = delaunayTriangulation(P,C)
DT = delaunayTriangulation(x,y)
DT = delaunayTriangulation(x,y,C)
DT = delaunayTriangulation(x,y,z)
DT = delaunayTriangulation()

Description

example

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 a matrix C.

example

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

expand all

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 of triangulation points, specified as a column vector.

y-coordinates of triangulation points, specified as a column vector.

z-coordinates of triangulation points, specified as a column vector.

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

expand all

Points in the triangulation, represented as a matrix with the following characteristics:

  • Each row in DT.Points contains the coordinates of a vertex.

  • Each row number of DT.Points is a vertex ID.

Triangulation connectivity list, represented as a matrix with the following characteristics:

  • Each element in DT.ConnectivityList is a vertex ID.

  • Each row represents a triangle or tetrahedron in the triangulation.

  • Each row number of DT.ConnectivityList is a triangle or tetrahedron ID.

Constrained edges, represented as a 2-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.

Object Functions

convexHullConvex hull
isInterior Query triangles inside Delaunay triangulation
voronoiDiagramVoronoi diagram
barycentricToCartesianConvert point coordinates from barycentric to Cartesian
cartesianToBarycentricConvert point coordinates from Cartesian to barycentric
circumcenterCircumcenter of triangle or tetrahedron
edgeAttachmentsTriangles or tetrahedra attached to specified edge
edgesTriangulation edges
faceNormalTriangulation face normal
featureEdgesTriangulation sharp edges
freeBoundaryQuery free boundary facets
incenterIncenter of triangle or tetrahedron
isConnectedTest if two vertices are connected by edge
nearestNeighborVertex closest to specified location
neighborsNeighbors to specified triangle or tetrahedron
pointLocationTriangle or tetrahedron containing specified point
sizeSize of triangulation connectivity list
vertexAttachmentsTriangles or tetrahedra attached to specified vertex
vertexNormalTriangulation vertex normal

Examples

expand all

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: []

Compute the center points of each triangle, and plot the triangulation with the center points.

IC = incenter(DT);
triplot(DT)
hold on
plot(IC(:,1),IC(:,2),'*r')

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.

tetramesh(DT,'FaceAlpha',0.3);

Compute and plot the convex hull of the triangulation.

[K,v] = convexHull(DT);
trisurf(K,DT.Points(:,1),DT.Points(:,2),DT.Points(:,3))

Definitions

expand all

Introduced in R2013a

Was this topic helpful?