# Bezier curves algorithm complex yet simple

I've got a path that is made up of multiple points - i.e. 0,0 0,50 50,50 70,20

If I just draw this line on the screen it looks quite harsh as it puts a sharp angle at the joining of each point.

Hence I was wondering what the bezier curves algorithm/method would look like which I could call that automatically change the sharp angles to "tight" curves?

I wouldn't want the curve to be too big or generally effect the fall of main path, just soften the join out. If you have a look at the below here is a quick sample I have put together. The line on the left is what I have now, the one in the middle is the line I want.

The image on the right represents what I think I need the algorithm to do. Essentially, I add an additional point to each arc that makes up the join at a point which 10% away from the join, then I remove the join point and adjust the handles so that they are where the point was (not in the diagram they are slightly apart, this is just so that you can see). This is what I need to be able to do.

-

It seems like you answered your own question in the last paragraph. You create the two new control points at each corner, and then replace the corner with a quadratic Bezier curve determined by the two new control points and the original corner point. So, it is not clear to me what you are asking. The de Casteljau algorithm can be used to render the curves.

-

What exactly do you want? If you want step-by-step software algorithm to draw a Bezier curve, and the "Don Lancaster's Guru's Lair Cubic Spline Library" doesn't have the answer, then the StackOverflow.com website is a better place to ask such questions.

-

Well, Bézier curves are always guaranteed to lie within the convex hull of the control points; it is only a matter of taste/convenience for you to adjust the control points to get the shape you wish. Try finding a program that allows you to interactively move control points around, and experiment!

-
@JM I think you have missed the point a little... I did this picture in PhotoShop really easily and its not a problem. But I want to do this automatically inside some software I'm writing, hence I need to calculate the splines based on a list of points that are feed in. So the algorithm should be able to receive a list of points and then feed me back the structure that contains the new points (if there are any new ones) and the splines that I need to use to draw the line... Does that make sense? – vdh_ant Sep 3 '10 at 14:46
Ah, then as long as you have the control points, it is a simple matter to derive the parametric equations for the corresponding Bézier curve. You can then evaluate the parametric equations at as fine a sampling as you please. – J. M. Sep 3 '10 at 15:04