Main Content

vertexAttachments

(Not recommended) Triangles or tetrahedra attached to vertex

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

TriRep is not recommended. Use triangulation instead.

Description

SI = vertexAttachments(TR) returns the vertex-to-simplex information for all vertices in the triangulation. For 2-D triangulations in MATLAB®, the triangles are arranged in counter-clockwise order around the attached vertex.

example

SI = vertexAttachments(TR,VI) returns the vertex-to-simplex information for the specified vertices VI.

Examples

collapse all

Load a 2-D triangulation and use TriRep to compute the vertex-to-triangle relations.

load trimesh2d
trep = TriRep(tri,x,y);

Find the indices of the tetrahedra attached to the first vertex.

Tv = vertexAttachments(trep,1)
Tv = 1x1 cell array
    {[107 108 109]}

Tv{:}
ans = 1×3

   107   108   109

Create a 2-D triangulation using DelaunayTri.

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

Find the triangles attached to vertex 5 and then plot them on top of the triangulation.

t = vertexAttachments(dt,5);
triplot(dt)
hold on
triplot(dt(t{:},:),x,y,'Color','r')
hold off

Input Arguments

collapse all

Triangulation representation, specified as a TriRep or DelaunayTri object.

Vertex indices, specified as a column vector. VI represents the vertex coordinates, TR.X. The simplices associated with vertex i are the i'th entry in the cell array.

Output Arguments

collapse all

Simplex indices, returned as a cell array. The cell array contains indices of the simplices attached to each vertex. A cell array is used to store the information because the number of simplices associated with each vertex can vary. The simplices associated with vertex i are in the i'th entry in the cell array SI.

More About

collapse all

Simplex

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

Extended Capabilities

Thread-Based Environment
Run code in the background using MATLAB® backgroundPool or accelerate code with Parallel Computing Toolbox™ ThreadPool.

Version History

Introduced in R2009a