Add calculation for the ds needed for spline