add method
Implementation
void add(Offset point) {
assert(_origin != null);
final nextPoint = point is OffsetPoint ? point : OffsetPoint.from(point);
if (_lastPoint!.distanceTo(nextPoint) < threshold) {
_temp = _line(_points.last, nextPoint);
return;
}
_points.add(nextPoint);
int count = _points.length;
if (count < 3) {
if (count > 1) {
_temp = _line(_points[0], _points[1]);
}
return;
}
int i = count - 3;
final prev = i > 0 ? _points[i - 1] : _points[i];
final start = _points[i];
final end = _points[i + 1];
final next = _points[i + 2];
final cpStart = CubicLine.softCP(
start,
previous: prev,
next: end,
smoothing: smoothRatio,
);
final cpEnd = CubicLine.softCP(
end,
previous: start,
next: next,
smoothing: smoothRatio,
reverse: true,
);
final line = CubicLine(
start: start,
cpStart: cpStart,
cpEnd: cpEnd,
end: end,
);
_addLine(line);
_temp = _line(end, next);
}