this should definitly not be part of CubicSpline2d. It's a one liner e.g.: max(0.0, s.eval(x))