Aakrasia solution is more accurate than roushenzo. Sadly still not perfect due to the tangents (distance is not linear), but it is a good approach. Maybe someone who knows mathematics could perfectionate it :-/. Are splines a bezier curve? Maybe I could investigate it. If I can make one perfect I will post it here.