The red dots are my data:
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..