I'm programming an AI for a race game, where my car has to drive through some checkpoints. If I let it drive straight in direction of the checkpoints, it has to slow down and make a huge turn after each checkpoint.
So I thought, I could calculate a curve through this checkpoints, which should be a trade-off between having the least possible curvature and being as short as possible.
If I have for example this 4 checkpoints:
\begin{align*} &A(6,8)\\ &B(10,2)\\ &C(6,3)\\ &D(2,2) \end{align*}
Then the curve should look approximately like this.
How can I calculate this? It has something to do with splines, but I'm not a mathematician and it's quite hard for me to find some understandable sources.
I think the easiest for me, would be, if somebody could provide an example, how to calculate the curve in my example?
The shortest possible curve would connect the points with straight lines. But that would mean essentially infinite curvature when you suddenly change direction. To smooth out the transition you have to lengthen the curve.
That means you have to specify some kind of tradeoff between length and curvature. You are right that various kinds of splines or bezier curves will do that. It's probably what Adobe has done; they keep their calculation under the hood in the software.
Why do you need to do the calculation yourself?