offsetCurve method

List<Bezier> offsetCurve(
  1. double distance, {
  2. double stepSize = 0.01,
})

Returns a List of Bezier instances that, when taken together, form an approximation of the offset curve distance units away from this.

See simpleSubcurves for information about the optional parameter stepSize.

Implementation

List<Bezier> offsetCurve(double distance, {double stepSize = 0.01}) {
  if (isLinear) {
    return [_translatedLinearCurve(distance)];
  }

  final reducedSegments = simpleSubcurves(stepSize: stepSize);
  final offsetSegments = reducedSegments.map((s) => s.scaledCurve(distance));
  return offsetSegments.toList();
}