cutAtProgress method
Implementation
(MeasuredCubic, MeasuredCubic) cutAtProgress(double cutOutlineProgress) {
final boundedCutOutlineProgress = cutOutlineProgress.coerceIn(
_startOutlineProgress,
_endOutlineProgress,
);
final outlineProgressSize = _endOutlineProgress - _startOutlineProgress;
final progressFromStart = boundedCutOutlineProgress - _startOutlineProgress;
final relativeProgress = progressFromStart / outlineProgressSize;
final t = measurer.findCubicCutPoint(
cubic,
relativeProgress * measuredSize,
);
if (t < 0 || t > 1) {
throw ArgumentError('Cubic cut point is expected to be between 0 and 1.');
}
final (c1, c2) = cubic.split(t);
return (
MeasuredCubic(
measurer: measurer,
cubic: c1,
startOutlineProgress: _startOutlineProgress,
endOutlineProgress: boundedCutOutlineProgress,
),
MeasuredCubic(
measurer: measurer,
cubic: c2,
startOutlineProgress: boundedCutOutlineProgress,
endOutlineProgress: _endOutlineProgress,
),
);
}