shortest distance to cubic spline