Class CubicBezierApproximator

java.lang.Object
org.apache.fop.afp.util.CubicBezierApproximator

public final class CubicBezierApproximator extends Object
This class can be used to convert a cubic bezier curve within a path into multiple quadratic bezier curves which will approximate the original cubic curve. The various techniques are described here: http://www.timotheegroleau.com/Flash/articles/cubic_bezier_in_flash.htm
  • Method Details

    • fixedMidPointApproximation

      public static double[][] fixedMidPointApproximation(double[] cubicControlPointCoords)
      This method will take in an array containing the x and y coordinates of the four control points that describe the cubic bezier curve to be approximated using the fixed mid point approximation. The curve will be approximated using four quadratic bezier curves the points for which will be returned in a two dimensional array, with each array within that containing the points for a single quadratic curve. The returned data will not include the start point for any of the curves; the first point passed in to this method should already have been set as the current position and will be the assumed start of the first curve.
      Parameters:
      cubicControlPointCoords - an array containing the x and y coordinates of the four control points.
      Returns:
      an array of arrays containing the x and y coordinates of the quadratic curves that approximate the original supplied cubic bezier curve.