warp.fem.utils.grid_to_tris#

warp.fem.utils.grid_to_tris(Nx, Ny)[source]#

Constructs a triangular mesh topology by dividing each cell of a dense 2D grid into two triangles.

The resulting triangles will be oriented counter-clockwise assuming that y is the fastest moving index direction

Parameters:
  • Nx (int) – Resolution of the grid along x dimension

  • Ny (int) – Resolution of the grid along y dimension

Returns:

Array of shape (2 * Nx * Ny, 3) containing vertex indices for each triangle