B-spline curve implementation code