3
votes

Given a few sample points on a bézier curve, is it possible to work out the set of possible curves these points may lie on?

In my specific application there is a limited set of endpoints the curve may have, so I want to generate the set of possible curves, enumerate all of them and pick out all the ones which may end on a valid end point.

Some people have asked for more detail. I have a set of points which I know are on a quadratic bezier curve, I want to calculate the formula of the curve and be able to extrapolate new points on the curve.

1
fitting the points using a single bezier curve... of course it can be done (the same way as you would fit points using a function - bezier curve "is" a function) and the link you provided already speaks about "RE" a bezier curveShinTakezou
Yes, but I want to know all possible curves these points lie on. The curve starting at the first point and ending at the last point is just one of many curves.Martin
with quadratic bezier curves you either have only one curve or less then four points through which the curve goes through. Also if you have more then four independent points you will not be able to find a single quadratic bezier curve that will pass through all of them.Unreason

1 Answers

6
votes

Bezier curves will always go through starting and ending control points.

If the degree of the curve is equal to the number of sample points then there will be only one curve that will pass through all your points (in a normal case, where all points are different and they don't lie on a bezier curve of a lesser degree).

If the degree of a curve is less then the number of the sample points then, in general case, you will not be able to make the curve go through all the points (in a normal case).

If the degree of a curve is higher then the number of the sample points then, in general case, you will be able to draw infinite number of curves.

In the wiki article you will find references to control points only, but still I believe that I remember the above properties correctly and that they hold for the points on the curves as well.

I think you need to redefine your question and exactly define what type of curves (and of which degree) do you need. Also as Georg pointed out you might be looking for paths - a combination of curves.

EDIT: First a correction - curve is defined with degree plus one number of control points points (quadratic need three). Control points are not the same as points on the curve - and for three points on the curve and quadratic curve you could have infinite number of solutions (see this for quadratic curve and four points)

As for the solution (but still under assumption that you are looking at a single curve):

For an equation for single quadratic curve you have

B(t) = (1-t)^2*P0 + 2*(1-t)*t*P1 + t^2*P2

Capital letters above are vectors, and P0 corresponds to starting control point (first point), P2 corresponds to ending control point (last point), so you still need to find P1. The variable t is scalar that ranges from 0 to 1.

If working with 2D curves the above vector equation gives two scalar equations for each point on the curve.

Still there is t as an unknown, so you should take 2 more points (4 in total) which will give you 4 unknowns (t for first point, t for second point, x and y of the P1, middle control point) and 4 equation to solve (2 from each sample point).

Solve that with your favourite numerical method and you will get the original curve on which the points came from.

If you still think that you can get more curves and that you will have to choose something then you are not working with bezier curves, but with bezier splines (in a sense of multiple curves joined together). Still the same principle applies and if you work out a way to solve a single curve from the above equations (and if you have enough points) then you can divide the problem into n-segments of actual bezier curves and solve each as outlined above.

If it turns out that you don't have enough points then look at the linked article again - you are probably looking for the smoothest curve and there are some suggestions in the article on how to get there as looking for the exact solution (shortest curve/smoothest curve) seems to be rather complex.