edges

All edges of a triangulation, as pairs of vertex indices.

Category: Mathematics > Computational Geometry

Syntax

E = edges(TR)

Returns each distinct edge once, as a row [v1 v2] with v1 < v2.

Description

Edges shared by neighbouring triangles are listed only once. For a mesh of V vertices, F triangles and E edges in a closed surface, V - E + F equals 2, which is a quick check on a mesh. The edge list is the input for drawing a wireframe or building a graph from the mesh.

Input arguments

TR
A triangulation, delaunayTriangulation, or a legacy DelaunayTri or TriRep object.

Output arguments

E
Two-column matrix of vertex indices, sorted by rows.

Example

Edges of a five-point mesh

x = [0 1 1 0 0.5]';
y = [0 0 1 1 0.5]';
DT = delaunayTriangulation(x, y);
E = edges(DT)
Output
E = 8×2

     1     2
     1     4
     1     5
     2     3
     2     5
     3     4
     3     5
     4     5

See also

edgeAttachments isConnected freeBoundary triangulation graph