note: this is an improved version of a program by Lubos Brieda
Here is the theory behind some modifications.
what did I change?
nodes (the circles) can be added or removed
a correction of the calculation: The original calculation contained an error in the last node.
When it was applied to a spline of only 2 nodes, the result would be a curve, not a straight line
an adaptation for small segments:
originally, curves would look like this, if nodes were near each other:
I decided that for smaller segments, the control points of the Bézier curve should be near the nodes.
This adaptation required a bit of calculus, because the curvature (say, the 2nd derivative of the spline with respect to "length of path") had to remain continuous at a node. (Whether this is visible or not - I programmed it in that way).
The result is