catmullRom static method
E3: Catmull-Rom Spline
Implementation
static LatLng catmullRom(
LatLng p0,
LatLng p1,
LatLng p2,
LatLng p3,
double t,
) {
double tt = t * t, ttt = tt * t;
double q1 = -ttt + 2 * tt - t;
double q2 = 3 * ttt - 5 * tt + 2;
double q3 = -3 * ttt + 4 * tt + t;
double q4 = ttt - tt;
return LatLng(
0.5 *
(p0.latitude * q1 +
p1.latitude * q2 +
p2.latitude * q3 +
p3.latitude * q4),
0.5 *
(p0.longitude * q1 +
p1.longitude * q2 +
p2.longitude * q3 +
p3.longitude * q4),
);
}