The OpenD Programming Language

metaSpline

Spline interpolator used for non-rectiliner trapezoid-like greeds.

Parameters

grid RCArray!(immutable X)

rc-array of interpolation grid

data RCArray!(const T)

rc-array of interpolator-like structures

configuration SplineConfiguration!F

SplineConfiguration Constraints: grid and values must have the same length >= 3

Return Value

Type: MetaSpline!(T, X)

Examples

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);

Meta