Suppose I have an ordered set of points on a plane, and I want to connect them each in order to make a smooth curve going through them all. The normal way to do this is to set a parameter "t", and have x and y both be functions of t, but have different functions between each adjacent pair of points, and fit them so that they meet at the 2 end points, and at the same slope at each end point.
So far, so good. Also, the slope is arbitrary, but a value must be chosen for it, so it's generally calculated by subtracting the x or y coordinate (depending on the function) of the previous point from the next point.
Everything's fine up to this point, but here's where the problem happens. Even though the curve goes through the points, I can't figure out how to guarantee that it will never bend very far away from where it should go, or even worse, make a loop! It especially seems to do this if the distance between the points greatly varies, or if they bend around in very unpredictable ways.
But I must make sure that the curve not only goes through all the points smoothly, but relatively simply, with no unnecessary wild curves, and never loops! How should I do this? Do I need to make or limit more degrees of freedom, such as the second derivative, perhaps?
I noticed that there's a dependency: when the slope is calculated at a point (dy/dx), it's really just the ratio of the slopes relative to the parameter [(dy/dt)/(dx/dt)] = dy/dx. So if I multiply both those derivatives by a constant, I'll have the same slope at that point, but the "speed" of the parameter's movement on the plane will be affected, and as it turns out, that affects the curvature.
It seems like the smaller I make the slopes, the tighter the curve will be, and the larger they are, the more chaotic it becomes. I want it to be tight, but not so tight as to look almost light strait lines with sightly rounded corners where the curves connect. I guess I'm wondering, how can I know the optimum scaling to apply to the slopes?