Home > Flex, Math > Quadratic Bezier, 3-point interpolation

Quadratic Bezier, 3-point interpolation

July 20, 2007

Using a quadratic bezier curve to interpolate three points is a very old algorithm, dating back to the early 1970’s. It’s been around quite some time in Flash, although in a simplified form sometimes called midpoint interpolation. This is because the parameter, or t-value, at which the curve passes through the second point is arbitrary. The formula happens to be compact when t = 0.5.  So, that is taken as the ‘interpolation formula’.  The midpoint formula has been passed around online and published in some Flash books.  The relationship of this formula to the actual parameterization of the curve is discussed in this TechNote.

Choosing a parameter value to interpolate the second point affects the placement of the middle Bezier control point. Since the control points form the set of geometric constraints for the curve, this is an example of a case where parameterization actually affects the shape of the curve.

The default parameterization for the Singularity Bezier2 class is based on chord-length. The t-value at which the quad. Bezier passes through the second point is determined by the fraction of the distance between the first and second points to the total chord length.

This online demo illustrates the difference between midpoint, chord-length, and arbitrary parameterizations. 

Advertisements
Categories: Flex, Math
  1. John Mangrin
    July 23, 2007 at 4:23 pm

    Interesting … didn’t know that. Is an AS 2 version available?

  2. July 25, 2007 at 6:50 am

    John:

    Yes, there is an AS 2 version, although not quite as ‘neat’ as the Flex/AS3 version. It’s the code from which the illustrations in the cubic Bezier TechNote were obtained. I’ll try to dig it up this weekend, and make it available for download.

    thanks,

    – jim

  3. March 13, 2008 at 4:38 am

    Hey Jim

    I’ve been searching around trying to find an equation (I prepered to re-write it into AS), to find the length of a quadratic bezier curve if I have the start and end point and a control point.

    Any pointers would be appreciated.

  4. March 13, 2008 at 5:57 am

    In general, the equation involves an elliptic integral. I think someone has worked it out for a quad bezier, but it’s messy. For general parameteric curves, the arc-length is numerically approximated. This approximation is already built into the Singularity Bezier classes, so you may download the library and use the existing code.

    The process is discussed in the TechNotes on arc-length of a C-R spline and arc-length parameterization.

    good luck!

    – jim

  1. No trackbacks yet.
Comments are closed.
%d bloggers like this: