forwardDiffBezier static method

void forwardDiffBezier(
  1. double c0,
  2. double c1,
  3. double c2,
  4. double c3,
  5. List<Vec2D> points,
  6. int count,
  7. int offset,
)

Implementation

static void forwardDiffBezier(double c0, double c1, double c2, double c3,
    List<Vec2D> points, int count, int offset) {
  double f = count.toDouble();

  double p0 = c0;

  double p1 = 3.0 * (c1 - c0) / f;

  f *= count;
  double p2 = 3.0 * (c0 - 2.0 * c1 + c2) / f;

  f *= count;
  double p3 = (c3 - c0 + 3.0 * (c1 - c2)) / f;

  // ignore: parameter_assignments
  c0 = p0;
  // ignore: parameter_assignments
  c1 = p1 + p2 + p3;
  // ignore: parameter_assignments
  c2 = 2 * p2 + 6 * p3;
  // ignore: parameter_assignments
  c3 = 6 * p3;

  for (int a = 0; a <= count; a++) {
    points[a][offset] = c0;
    // ignore: parameter_assignments
    c0 += c1;
    // ignore: parameter_assignments
    c1 += c2;
    // ignore: parameter_assignments
    c2 += c3;
  }
}