initNonuniformCatmullRom method

dynamic initNonuniformCatmullRom(
  1. dynamic x0,
  2. dynamic x1,
  3. dynamic x2,
  4. dynamic x3,
  5. dynamic dt0,
  6. dynamic dt1,
  7. dynamic dt2,
)

Implementation

initNonuniformCatmullRom(x0, x1, x2, x3, dt0, dt1, dt2) {
  // compute tangents when parameterized in [t1,t2]
  var t1 = (x1 - x0) / dt0 - (x2 - x0) / (dt0 + dt1) + (x2 - x1) / dt1;
  var t2 = (x2 - x1) / dt1 - (x3 - x1) / (dt1 + dt2) + (x3 - x2) / dt2;

  // rescale tangents for parametrization in [0,1]
  t1 *= dt1;
  t2 *= dt1;

  init(x1, x2, t1, t2);
}