setAnchorsAndHandles method

void setAnchorsAndHandles(
  1. List<Vector3> anchor1,
  2. List<Vector3> handle1,
  3. List<Vector3> handle2,
  4. List<Vector3> anchor2,
)

Implementation

void setAnchorsAndHandles(List<Vector3> anchor1, List<Vector3> handle1,
    List<Vector3> handle2, List<Vector3> anchor2) {
  var nppc = nPointsPerCurve; // 4
  var totalLength = nppc * anchor1.length;
  points = [for (var _ in range(end: totalLength)) ORIGIN];
  var arrays = [anchor1, handle1, handle2, anchor2];

  for (var i in range(end: nppc)) {
    var vec = arrays[i];
    var indices = range(start: i, end: points.length, step: nppc);
    for (var kj in enumerate(indices)) {
      var k = kj.item1; // index in "indices" list
      var j = kj.item2; // value in "indices" list
      points[j] = vec[k % vec.length];
    }
  }
}