0

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?

johz
  • 15
  • 4

1 Answers1

0

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]

Rockcat
  • 3,002
  • 2
  • 14
  • 28
  • I see that this function returns a list containing the id of the 3 neighbors of a triangle. But is there a way to have a list that contains the coordinates of the vertices for each triangle? – johz Nov 29 '20 at 22:28