I have a list of x and y coordinates and used those to create an irregular triangular grid by calling tr=tri.Triangulation(a, b, triangles=None, mask=None)
, where a is the list of x-coordinates and b is a list of y-coordinates. I was able to get a grid like this
grid
I wonder if there is a way to know the coordinates of the 3 vertices of each triangular element?
The indexes of triangles are stored in tr.neighbors. It is an array (numTriangles, 3) Each index is the position of x value in a, and y value in b.
Then build coordinates as [ (a[id[0]], b[id[0]]), (a[id[1]], b[id[1]]), (a[id[2]], b[id[2]]) for id in tr.neighbors]