trying a variant which precomputes gradients for x and y once for all
interpolated values.