B-Spline implementation