2D trapezoid-like (not rectilinear) linear interpolation
auto x = [ [0.0, 1, 2, 3, 5], [-4.0, 3, 4], [0.0, 10], ]; auto y = [ [4.0, 0, 9, 23, 40], [9.0, 0, 3], [4.0, 40], ]; auto g = [7.0, 10, 15]; import mir.rc.array: RCArray; import mir.ndslice.allocation: rcslice; auto d = RCArray!(Spline!double)(3); foreach (i; 0 .. x.length) d[i] = spline!double(x[i].rcslice!(immutable double), y[i].rcslice!(const double)); auto trapezoidInterpolator = metaSpline!double(g.rcarray!(immutable double), d.lightConst); auto val = trapezoidInterpolator(9.0, 1.8);
Spline interpolator used for non-rectiliner trapezoid-like greeds.