[Math] Bezier extrapolation

bezier-curveextrapolation

The red dots are my data:

enter image description here

I know that they are on a Bézier curve of order 5 (6 control points). There are extra restrictions on the 6 control points A,B,C,D,E & F:

  • A & B are on a horizontal line
  • B & C are on a vertical line
  • C & D are on a horizontal line
  • D & E are on a vertical line
  • E & F are on a horizontal line

(the black arrows in the image)

Now there is a lot of material on this site and on the internet on how to do a least squares fit of points to a Bézier curve. But the method in that case is that the first control point is equal to the first data point, and the last control point is on the last data point, which makes it easy to "synchronize" your t variable (that goes from 0 to 1) in your Bézier equation with the data.

But what if we know that the last (most-right) control point is to the right of the last data point? I can do it manually in a flash script or in Geogebra, so it should be doable mathematically. But how?

So to recap: the data ends at the red arrow, but to get the best fit under the restrictions, how do I calculate the control points so the fitted green curve ends at the green arrow?

Probably something related to the fact that the tangent line in the last control point is also horizontal under my restrictions, but yeah..

Best Answer

Here is how you can fit $y$ as a function of $x$. Suppose that

  • Points A and B have $y$-coordinate $a$
  • Points C and D have $y$-coordinate $b$
  • Points E and F have $y$-coordinate $c$
  • Point A has $x$-coordinate $h$
  • Point F has $x$-coordinate $k$

Let $u = (x-h)/(k-h)$. Then the general equation of a curve of degree 5 that satisies your constraints is: $$ y(u) = a(1-u)^5 + 5au(1-u)^4 + 10bu^2(1-u)^3 + 10bu^3(1-u)^2 + 5cu^4(1-u) + cu^5 $$ for $0 \le u \le 1$.

Now use standard least-squares fitting techniques to find the values of $a$, $b$, $c$ that give the best fit to your data points.

Related Question