Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I found this very informative site that discusses forcing bezier interpolation and the site gives formulae for calculating the control points so that the curve goes through a set of four points, y0, y1, y2 and y3, for t=0, 1/3, 2/3, 1 respectively.

The formulae given on this site are as follows:

P0 = y0
P1 = ( -5 * y0 + 18 * y1 -  9 * y2 + 2 y3 ) / 6
P2 = (  2 * y0 -  9 * y1 + 18 * y2 - 5 y3 ) / 6
P3 = y3

What I am looking for is a more general form of the formulae for calculating P1 and P2. So instead of having fixed values of t of 1/3 and 2/3, rather to express them as a function of t1 and t2, where t1 is the value of t for point y1 and t2 is the value of t for y3. Can someone please help in deriving these more general formulae?

share|cite|improve this question
How much do you know about Bézier curves? In particular, do you know a general formula for the point at a given value of $t$? – Peter Taylor May 16 '13 at 9:09
Hi Peter. I don't know that much about Bezier curves. I am actually a programmer and this is the first time I am having to deal with curves; so trying to figure this stuff out. I have read the general formula, but can't say I understand it. You can look at my question here… to see what I am trying to accomplish. The formula that I posted here does work and the curve goes through the points, but the positioning on the curve at t=1/3 and t=2/3 is not ideal. – BruceHill May 16 '13 at 11:20
Oh, and I realize my question on stackoverflow shows a quadratic curve... I solved the problem stated in this question for quadratic curves and now am trying to solve for cubic bezier curves. – BruceHill May 16 '13 at 11:26

Without going into the full theoretical background, Bézier curves use a set of polynomials called Bernstein polynomials to weight the points. For a cubic Bézier, which seems to be what your question is about, this results in the parametric definition $$P(t) = (1-t)^3 P_0 + 3t(1-t)^2 P_1 + 3t^2(1-t) P_2 + t^3 P_3$$

When $t = 0$ this gives simply $P(0) = P_0$, and similarly $P(1) = P_3$. So we only have two degrees of freedom in forcing the curve to pass through your intermediate control points. As the site you linked mentioned, we can set up simultaneous equations:

$$\begin{eqnarray*} & P_0 & & & & & = & y_0 \\ (1-t_1)^3 & P_0 & + 3t_1(1-t_1)^2 & P_1 + 3t_1^2(1-t_1) & P_2 + t_1^3 & P_3 & = & y_1 \\ (1-t_2)^3 & P_0 & + 3t_2(1-t_2)^2 & P_1 + 3t_2^2(1-t_2) & P_2 + t_2^3 & P_3 & = & y_2 \\ & & & & & P_3 & = & y_3 \end{eqnarray*}$$

which easily reduce to

$$\begin{eqnarray*}3t_1(1-t_1)^2 & P_1 + 3t_1^2(1-t_1) & P_2 & = & y_1 - (1-t_1)^3 y_0 - t_1^3 y_3 \\ 3t_2(1-t_2)^2 & P_1 + 3t_2^2(1-t_2) & P_2 & = & y_2 - (1-t_2)^3 y_0 - t_2^3 y_3 \end{eqnarray*}$$

I assume you can take it from here.

share|cite|improve this answer
I will have to brush up a bit on solving simultaneous equations, but yes, I can take it from here. Thanks, Peter. – BruceHill May 16 '13 at 11:49

A couple of comments (but too long for the comment box, I think).

First, if you try somewhat harder, you can actually get a planar cubic Bezier curve to interpolate six points, not just four. As you have realized, when interpolating four points, you have to make up parameter values for two of them. The standard choices are $\tfrac13$ and $\tfrac23$, but there's nothing magic about these -- you can use any values you like, and you'll still be able to solve the simultaneous equations and get a curve. But the shape of this curve is highly dependent on the choice you make, so it would be better if you didn't have to make it. By providing another two points, you can remove this troublesome choice. The details are described in this paper. It's probably more complicated than you need, right now, but maybe useful some day.

Secondly ... Peter Taylor's solution involves solving a system of linear equations (or, equivalently, inverting a 4x4 matrix). This isn't very difficult, but you can avoid it by using Lagrange polynomials. Once you have chosen parameter values for the two interior points, you can simply write down the equations of a cubic polynomial curve that passes through the 4 points. This is a standard technique that's explained in any decent numerical analysis text. There are some simple numerical examples on this Wikipedia page. Once you've done this, you might want to convert the curve from polynomial ("power basis") form to Bezier form. This is straightforward and very fast -- it just requires a matrix multiplication.

Peter's solution is simple and easy to implement, and it probably suits your needs. If you want to try either of the alternatives I suggested, ask again, and I can give you more details.

share|cite|improve this answer
For fitting four points with prechosen t it suffices to solve two simultaneous linear equations in two variables, which is something people learn at age around 15 in my country, whereas Lagrange form isn't covered in the standard school syllabus at all. That paper's interesting, though: I've added it to my list of things to read. – Peter Taylor May 17 '13 at 10:19
> two simultaneous linear equations in two variables. Yeah, I guess that's right. There are four equations, but two of them are trivial, so only the other two really need to be "solved". – bubba May 17 '13 at 11:51

Your Answer


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.