Main Content

isConnected

Test if two vertices are connected by an edge

Description

example

TF = isConnected(TR,startID,endID) returns a logical column vector whose elements are 1 (true) when the specified starting and ending pairs of vertices are connected by an edge. startID and endID specify edges by their starting and ending points, where each point is represented by its row number in TR.Points. The return value ID identifies triangles by their identification numbers.

example

TF = isConnected(TR,E) specifies the edge start and end vertex IDs in a two-column matrix E.

Examples

collapse all

Load a 2-D triangulation.

load trimesh2d
TR = triangulation(tri,x,y);

Determine whether vertices 3 and 117 are connected by an edge.

TF = isConnected(TR,3,117)
TF = logical
   1

Determine whether vertices 3 and 164 are connected by an edge.

TF = isConnected(TR,3,164)
TF = logical
   0

Create a 3-D Delaunay triangulation.

rng default;
X = rand([10,3]);
DT = delaunayTriangulation(X);

Determine whether vertices 2 and 7 are connected by an edge, and whether vertices 4 and 9 are connected.

E = [2 7; 4 9];
TF = isConnected(DT,E)
TF = 2x1 logical array

   0
   1

Input Arguments

collapse all

Triangulation representation, specified as a scalar triangulation or delaunayTriangulation object.

Data Types: triangulation | delaunayTriangulation

Starting vertex identification for each edge, specified as a column vector. A vertex identification number is the number of the row in the Points property that corresponds to the vertex.

Data Types: double

Ending vertex identification for each edge, specified as a column vector. A vertex identification number is the number of the row in the Points property that corresponds to the vertex.

Data Types: double

Edge matrix, specified as a two-column matrix. Each row contains the starting and ending vertex identifications for an edge. A vertex identification number is the number of the row in the Points property that corresponds to the vertex.

Data Types: double

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 R2013a