setPointsAsCorners method

void setPointsAsCorners(
  1. List<Vector3> points
)

Implementation

void setPointsAsCorners(List<Vector3> points) {
  var alphas =
      linspace(start: 0, end: 1, count: nPointsPerCurve).getColumn(0);

  var ptsWithoutFirst = Array.fromVectorList(withoutFirst(points));

  var ptsWithoutLast = Array.fromVectorList(withoutLast(points));

  var anchorsAndHandlesArrays = [
    for (var alpha in alphas)
      interpolateValue<Array>(ptsWithoutLast, ptsWithoutFirst, alpha)
  ];

  var anchorsAndHandlesVectorLists = [
    for (var arr in anchorsAndHandlesArrays)
      [for (var vec in arr.values) Vector3(vec[0], vec[1], vec[2])]
  ];

  setAnchorsAndHandles(
    anchorsAndHandlesVectorLists[0],
    anchorsAndHandlesVectorLists[1],
    anchorsAndHandlesVectorLists[2],
    anchorsAndHandlesVectorLists[3],
  );
}