Gradient interpolation with 3+ points

Correction, it should be float d_total