This is machine translation

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


Class: triangulation

Neighbors to specified triangle or tetrahedron


N = neighbors(TR,ti)
N = neighbors(TR)


N = neighbors(TR,ti) returns the neighbors of the triangles or tetrahedra specified in ti.

N = neighbors(TR) returns the neighbors of all the triangles or tetrahedra.

Input Arguments


Triangulation representation, see triangulation or delaunayTriangulation.


Triangle or tetrahedron IDs, specified as a column vector.

Output Arguments


IDs of the neighboring triangles or tetrahedra, returned as a matrix. The elements in TN(i,:) are the neighbors associated with ti(i).

By convention, TN(i,j) is the neighbor opposite the jth vertex of ti(i). If a triangle or tetrahedron has one or more boundary facets, the nonexistent neighbors are represented as NaN values in TN.


Triangle or Tetrahedron ID

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

Vertex ID

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


expand all

Create a Delaunay triangulation from a set of random points.

x = gallery('uniformdata',[10,1],0);
y = gallery('uniformdata',[10,1],1);
DT = delaunayTriangulation(x,y);

Find the neighbors of the first triangle.

TN = neighbors(DT,1)
TN =

   NaN     4     5

The first triangle has a boundary edge and two neighbors.

Examine the vertex IDs of the first neighbor, TN(2).

ans =

     2     4     7

Create the Delaunay triangulation.

load tetmesh
TR = triangulation(tet,X);

Find the neighbors to each triangle in the triangulation.

TN = neighbors(TR);

Find the neighbors of the fifth tetrahedron.

ans =

        2360        1539           2        1851

Examine the vertex IDs of the first neighbor, TN(1).

ans =

        1093         891         893         858

Was this topic helpful?