Problem 45218. Find a common edge
First input is T, a triplet list of indices. Second input is e = [e1 e2], a row vector, couple of indices (positive distinct integers always sorted in ascending order, ie e1 < e2 ). The goal of this function is to find and return the indices of the rows in the list which contain this particular edge. Output format can be either a column or a row vector.
For example if inputs are
T = [1 2 3 ;
1 3 4 ;
1 4 2 ;
2 3 4]
and
e = [2 3]
the output is the vector
row_idx = [1 4]
since [2 3] is contained in rows number 1 and 4 of T. With the same input T, but with e = [2 4] this time, the output is the vector row_idx = [3 4], since [2 4] is contained in rows number 3 and 4 of T (Note that edge [b a] is the same as edge [a b] so must be the corresponding outputs). If the edge is not in the list, the function must of course return the empty set.
See also
Solution Stats
Problem Comments
-
1 Comment
Nicolas Douillet
on 1 Dec 2019
Info : T is actually a triangulation -list of triangles-, in which each index corresponding to the row index of a vertex in another list -a vertices list-, it is a widely used technique used to store and write triangular meshes in mesh processing. Here below the example is a tetrahedron -4 facets-.
Solution Comments
Show commentsProblem Recent Solvers41
Suggested Problems
-
middleAsColumn: Return all but first and last element as a column vector
640 Solvers
-
The Answer to Life, the Universe, and Everything
571 Solvers
-
Find the maximum two numbers of every column of a matrix
227 Solvers
-
765 Solvers
-
find "greatest common divisor" of two integer value
198 Solvers
More from this Author42
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!