generatePoints method

  1. @override
void generatePoints()
override

Implementation

@override
void generatePoints() {
  var discontinuities = [
    ...this.discontinuities.where((t) => t >= tMin && t <= tMax)
  ];

  var boundaryTimes = [
    tMin,
    tMax,
    for (var t in discontinuities) ...[t - dt, t + dt],
  ]..sort();

  for (var i in range(end: boundaryTimes.length ~/ 2)) {
    var t1 = boundaryTimes[i + 0];
    var t2 = boundaryTimes[i + 1];

    var tRange =
        arange(start: t1, end: t2, step: getStepSize(t1)).getColumn(0);

    if (tRange.last != t2) {
      tRange.add(t2);
    }

    var points = [for (var t in tRange) getPointFromParametricFunction(t)];
    points = [
      for (var pt in points)
        if (!pt.isNan() && pt.isFinite()) pt
    ];

    if (points.isNotEmpty) {
      startNewPath(points.first);
      addPointsAsCorners(withoutFirst(points));
    }
  }

  // TODO make "makeSmooth" work properly
  // makeSmooth();
}