isConnected

Tests whether pairs of vertices are joined by an edge in a triangulation.

Category: Mathematics > Computational Geometry

Syntax

tf = isConnected(TR, v1, v2)

true for each pair v1(i), v2(i) that forms an edge.

tf = isConnected(TR, E)

Pairs given as the rows of the two-column matrix E.

Description

Two vertices are connected when some triangle (tetrahedron) of the mesh has both as corners. Being connected here means directly joined by an edge, not reachable through a path. Order does not matter: (a, b) and (b, a) give the same answer.

Input arguments

TR
A triangulation or delaunayTriangulation object.
v1, v2
Column vectors of vertex indices.

Output arguments

tf
Logical column vector, one value per pair.

Example

Which pairs are edges

x = [0 1 1 0 0.5]';
y = [0 0 1 1 0.5]';
DT = delaunayTriangulation(x, y);
tf = isConnected(DT, [1; 1], [2; 3])
Output
tf = 2×1 logical array

   1
   0

See also

isEdge edges edgeAttachments triangulation