catmullRom static method
t -- interpolation weight.
p0, p1, p2, p3 -- the points defining the spline curve.
Used internally by SplineCurve.
Implementation
static double catmullRom(double t, double p0, double p1, double p2, double p3) {
final v0 = (p2 - p0) * 0.5;
final v1 = (p3 - p1) * 0.5;
final t2 = t * t;
final t3 = t * t2;
return (2 * p1 - 2 * p2 + v0 + v1) * t3 +
(-3 * p1 + 3 * p2 - 2 * v0 - v1) * t2 +
v0 * t +
p1;
}