I remember seeing a code example with a modulo operator being used to combine the corner vertices (indices) of mesh triangle face (index combinations: 0,1 - 1,2 - 2,0) but I can’t remember that formula. I think it was a code example by @DanielPiker but it could have been someone else.
The code I resorted to use for this purpose looks just too ugly:
var index = -1;
var v_i = mesh.Faces.GetTopologicalVertices(i);
if (GetClosestEdgeIndex(mid_pt, v_i[0], v_i[1], out index))
ne_indices[edge_cnt] = index;
else if (GetClosestEdgeIndex(mid_pt, v_i[1], v_i[2], out index))
ne_indices[edge_cnt] = index;
else if (GetClosestEdgeIndex(mid_pt, v_i[2], v_i[0], out index))
ne_indices[edge_cnt] = index;
It would be more compact using the modulo approach instead.
// Rolf