hermite function

double hermite(
  1. double p0,
  2. double p1,
  3. double p2,
  4. double p3,
  5. double mu,
  6. double tension,
  7. double bias,
)

Implementation

double hermite(double p0, double p1, double p2, double p3, double mu,
    double tension, double bias) {
  double m0, m1, mu2, mu3;
  double a0, a1, a2, a3;
  mu2 = mu * mu;
  mu3 = mu2 * mu;
  m0 = (p1 - p0) * (1 + bias) * (1 - tension) / 2;
  m0 += (p2 - p1) * (1 - bias) * (1 - tension) / 2;
  m1 = (p2 - p1) * (1 + bias) * (1 - tension) / 2;
  m1 += (p3 - p2) * (1 - bias) * (1 - tension) / 2;
  a0 = 2 * mu3 - 3 * mu2 + 1;
  a1 = mu3 - 2 * mu2 + mu;
  a2 = mu3 - mu2;
  a3 = -2 * mu3 + 3 * mu2;
  return (a0 * p1 + a1 * m0 + a2 * m1 + a3 * p2);
}