Generate an invertible grid.