toArc method
Converts this cubic line into a list of CubicArc segments. This is used to approximate the curve with a series of arcs for drawing.
size
The base size for the arcs.
deltaSize
The change in size across the arc.
precision
The precision for generating arc segments (higher value means more segments).
Returns a list of CubicArc objects.
Implementation
List<CubicArc> toArc({double? deltaSize, double precision = 0.5}) {
final list = <CubicArc>[];
final steps = (_distance * precision).floor().clamp(1, 30);
Offset start = this.start;
for (int i = 0; i < steps; i++) {
final t = (i + 1) / steps;
final loc = point(t);
final width = startSize + (deltaSize ?? (endSize - startSize)) * t;
list.add(CubicArc(
start: start,
location: loc,
size: width,
));
start = loc;
}
return list;
}