The OpenD Programming Language

MetaSpline

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

Constructors

this
this(RCArray!(immutable X) grid, RCArray!(const T) data, SplineConfiguration!F configuration)

Members

Aliases

withDerivative
alias withDerivative = opCall!1
withTwoDerivatives
alias withTwoDerivatives = opCall!2

Functions

gridScopeView
immutable(X)[] gridScopeView()
intervalCount
size_t intervalCount()
lightConst
MetaLinear lightConst()
opEquals
bool opEquals(typeof(this) rhs)

Templates

opCall
template opCall(uint derivative = 0)

Variables

configuration
SplineConfiguration!F configuration;
data
RCArray!(const T) data;
derivativeOrder
enum uint derivativeOrder;
dimensionCount
enum uint dimensionCount;

Return Value

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