generate method
Generates curve points from the given data points.
Implementation
@override
List<Point> generate(List<Point> points) {
if (points.length < 2) return List.from(points);
if (points.length == 2) return List.from(points);
final n = points.length;
final result = <Point>[];
const segments = 10;
// Calculate spline coefficients
final px = _naturalSpline(points.map((p) => p.x).toList());
final py = _naturalSpline(points.map((p) => p.y).toList());
result.add(points.first);
for (int i = 0; i < n - 1; i++) {
for (int j = 1; j <= segments; j++) {
final t = j / segments;
final x = _evaluateSpline(px, i, t);
final y = _evaluateSpline(py, i, t);
result.add(Point(x, y));
}
}
return result;
}