simpleSubcurves method

List<Bezier> simpleSubcurves(
  1. {double stepSize = 0.01}
)

Returns a List of simple Bezier instances that make up this when taken together. In cases where no simple subcurves can be found with the given stepSize, returns an empty List.

Reduction is performed in two passes. The first pass splits the curve at the parameter values of extrema along the x and y axes. The second pass divides any non-simple portions of the curve into simple curves. The optional stepSize parameter determines how much to increment the parameter value at each iteration when searching for non-simple portions of curves. The default stepSize value of 0.01 means that the function will do around one hundred iterations for each segment between the parameter values for extrema. Reducing the value of stepSize will increase the number of iterations.

Implementation

List<Bezier> simpleSubcurves({double stepSize = 0.01}) {
  final reductionResults = simpleSlices(stepSize: stepSize);
  return reductionResults.map((r) => r.subcurve).toList();
}