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.

neighbors

Neighbors to specified triangle or tetrahedron

Syntax

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

Description

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

TR

Triangulation representation, see triangulation or delaunayTriangulation.

ti

Triangle or tetrahedron IDs, specified as a column vector.

Output Arguments

TN

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.

Examples

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).

DT.ConnectivityList(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.

TN(5,:)
ans = 

        2360        1539           2        1851

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

TR.ConnectivityList(TN(1),:)
ans = 

        1093         891         893         858

Definitions

expand all

Was this topic helpful?