Use gradient instead of derivatives by hand
Finally fix the weird indexing
Caused by gradient treating the second dimension as the
x-dimension, and not the y-dimension. So we have to swap x and y
when creating the voxel form