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.


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.


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


expand all

Was this topic helpful?