getPoints method

  1. @override
List getPoints([
  1. num divisions = 12
])
override

Implementation

@override
List getPoints([num divisions = 12]) {
  var points = [];
  var last;

  for (var i = 0, curves = this.curves; i < curves.length; i++) {
    var curve = curves[i];
    var resolution = (curve.isEllipseCurve)
        ? divisions * 2
        : ((curve is LineCurve || curve is LineCurve3))
            ? 1
            : (curve.isSplineCurve)
                ? divisions * curve.points.length
                : divisions;

    var pts = curve.getPoints(resolution);

    for (var j = 0; j < pts.length; j++) {
      var point = pts[j];

      if (last != null && last.equals(point)) {
        continue;
      } // ensures no consecutive points are duplicates

      points.add(point);
      last = point;
    }
  }

  if (autoClose && points.length > 1 && !points[points.length - 1].equals(points[0])) {
    points.add(points[0]);
  }

  return points;
}