Problem 45220. Find triangles from edge

First input is T, a Triplet list of indices -whom each row actually contains the three indices of a triangle vertices-. size(T) = [nb_triangles, 3]. Second input is e = [e1, e2], a row vector, couple of indices. Output S is the triplet list of indices which Share the edge e. For instance, if

e = [2, 4]

and T a tetrahedron

T = [1, 2, 3;...
     1, 3, 4;...
     1, 2, 4;...
     2, 3, 4]

then the output of the function is

S = [1, 2, 4;...
     2, 3, 4]

since both triangles [1, 2, 4] and [2, 3, 4] contain the edge [2, 4].

Conditions :

  • If the edge is not part of any triangle in the list, the function must of course return the empty set, [].
  • Edges are symmetric : [e1, e2] is the same edge as [e2, e1]
  • Order of rows / edges in the output doesn't matter.
  • Triangle indices are assumed always to be sorted in ascending order, T = [t1, t2, t3] with t1 < t2 < t3.
  • Every indices are positive, distinct integers.

Solution Stats

53.19% Correct | 46.81% Incorrect
Last Solution submitted on Dec 15, 2024

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers24

Suggested Problems

More from this Author9

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!