bezier function

Vector3 Function(double) bezier(
  1. List<Vector3> points
)

Implementation

Vector3 Function(double) bezier(List<Vector3> points) {
  var n = points.length - 1;

  return (t) => ([
        for (var kPoint in enumerate(points))
          kPoint.item2 *
              (pow(1 - t, n - kPoint.item1) *
                  pow(t, kPoint.item1) *
                  choose(n, kPoint.item1))
      ]).reduce((a, b) => a + b);
}