Add some docs to cubic spline
Organize code
Fix segment detection
Allow direct evaluation of the curve