Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

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.

alt text

share|improve this question

3 Answers 3

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.

share|improve this answer

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.

share|improve this answer

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!

share|improve this answer
1  
@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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.