Main Content

neighbors

(Not recommended) Triangle or tetrahedron neighbors

neighbors(TriRep) is not recommended. Use neighbors(triangulation) instead.

TriRep is not recommended. Use triangulation instead.

Description

SN = neighbors(TR) returns the simplex neighbor information for all simplices in the triangulation. The neighbors associated with simplex i are defined by the i'th row of the output SN.

example

SN = neighbors(TR,SI) returns the simplex neighbor information for the specified simplices SI.

example

Examples

collapse all

Load a 3-D triangulation and use TriRep to compute the neighbors of all tetrahedra.

load tetmesh
trep = TriRep(tet,X);
nbrs = neighbors(trep);

You can use the output to find the neighbors of any specific tetrahedron in the triangulation. For example, the neighbors of tetrahedron 3 are nbrs(3,:).

nbrs(3,:)
ans = 1×4

        2564         670           2        4199

Create a 2-D triangulation using DelaunayTri.

x = rand(10,1);
y = rand(10,1);
dt = DelaunayTri(x,y);

Find the neighbors of the first triangle.

n1 = neighbors(dt,1)
n1 = 1×3

     4     8     5

Input Arguments

collapse all

Triangulation representation, specified as a TriRep or DelaunayTri object.

Simplex indices, specified as a column vector. SI contains simplex indices that index into the triangulation matrix TR.Triangulation.

Output Arguments

collapse all

Simplex neighbors, returned as a matrix. SN is an m-by-n matrix, where m = length(SI) , the number of specified simplices, and n is the number of neighbors per simplex. Each row SN(i,:) represents the neighbors of the simplex SI(i).

By convention, the simplex opposite vertex(j) of simplex SI(i) is SN(i,j). If a simplex has one or more boundary facets, the nonexistent neighbors are represented by NaN.

More About

collapse all

Simplex

A simplex is a triangle/tetrahedron or higher-dimensional equivalent.

Facet

A facet is an edge of a triangle or a face of a tetrahedron.

Version History

Introduced in R2009a