catmullRom function

double catmullRom(
  1. double edge0,
  2. double edge1,
  3. double edge2,
  4. double edge3,
  5. double amount,
)

Do a catmull rom spline interpolation with edge0, edge1, edge2 and edge3 by amount.

Implementation

double catmullRom(double edge0, double edge1, double edge2, double edge3,
        double amount) =>
    0.5 *
    ((2.0 * edge1) +
        (-edge0 + edge2) * amount +
        (2.0 * edge0 - 5.0 * edge1 + 4.0 * edge2 - edge3) * (amount * amount) +
        (-edge0 + 3.0 * edge1 - 3.0 * edge2 + edge3) *
            (amount * amount * amount));