A Generated Mesh

To generate a grid of lines for this mesh, begin with an empty line array. Generate the row-wise grid lines.

for r = 0 to n − 1
  for c = 0 to n − 2
    Add a new line $[i_0, i_2]$ at row r column c.

And generate the column-wise grid lines.

for r = 0 to n − 2
  for c = 0 to n − 1
    Add a new line $[i_0, i_1]$ at row r column c.