# Cubic Bezier 4-point Interpolation Preview

The next online demo will be four-point interpolation for a cubic Bezier curve.  This TechNote shows the general algorithm for three-point interpolation using a quadratic Bezier.  It may seem as if the only variable is where to place the middle control point so that the quadratic Bezier passes through the specified second point.  The classic midpoint algorithm (the formula you may have seen making its way around the Flash community) causes the curve to pass through the interior interpolation point at t = 0.5.

Selection of a parameter value is arbitrary as the shape of the interpolated curve depends on the t-parameter at the second interpolation point.  This issue is discussed in the TechNote and illustrated in this online demo.

The situation is similar, although more complex for a cubic Bezier curve.  Four control points must be determined so that the cubic curve passes through four specified points.  The two endpoints are trivial, so the problem reduces to finding the two middle control points.  The parameter values at the interpolation points must be specified in order to solve for the control point placement.  Uniform parameterization selects t = 0 for the first interpolation point, t = 1/3 for the second, t = 2/3 for the third and t = 1 for the final point.

If the four control points are P0, P1, P2, and P3, then there are four unknowns; the x- and y-coordinates of P1 and P2.  The upcoming demo will illustrate a chord-length parameterization of the interpolating Bezier.   Given the parameter values at the two interior interpolation points, the equation for a cubic Bezier can be used to create a system of equations in P1 and P2.

These equations can be solved with a variety of methods, although there are some numerical issues with nearly or exactly overlapping interior interpolation points.

I hope to work on the code over the weekend, with a new demo up some time early next week.