face normal consistencies
The function in your third code snippet is checking for the winding order to be consistent between two neighboring triangles. It does this by looking at the order in which vertices are listed in their shared edge. If the two triangles have consistent winding (both counterclockwise for instance), they will have opposite orientations for the shared edge.

A diagram may help see this:


The vertex order is indicated by the blue arrows:

t0: v0, v1, v2
t1: v1, v3, v2


If you look at the shared edge (v1&ndash;v2), it appears in the first triangle with order v1, v2, and in the other with order v2, v1 (cycling around the end of the vertex list back to the beginning).

The function in your snippet takes a triangle and looks at one of its neighbors, checks all three possibilities for which edge in the second triangle is the shared one, and checks that the vertices in that (other triangle's) edge appear in the reverse order to the vertices in the current triangle's edge. It returns true if this is the case, and false otherwise.