Span<double> data = stackalloc double[] { 10.0, 20.0, 30.0, 40.0, 50.0 };
Console.WriteLine($"Linear Interpolation at 1.5: {value1}");
Console.WriteLine($"Linear Interpolation at 2.8: {value2}");
try
{
Span<double> smallBuffer = stackalloc double[] { 1.0 };
Interpolation.GetValue(linear, 0.5, smallBuffer);
}
catch (ArgumentOutOfRangeException ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
try
{
Interpolation.GetValue(linear, 0.1, data);
}
catch (ArgumentException ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
補間処理を行う静的クラスです。
Definition Interpolation.cs:70
static double GetValue(IInterpolationAlgorithm algorithm, double position, Span< double > buffer)
指定された補間アルゴリズムとデータバッファを使用して、特定の位置の値を補間して取得します。
Definition Interpolation.cs:116
線形補間アルゴリズムの実装例です。
Definition Interpolation.cs:49
補間アルゴリズムのインターフェース
Definition IInterpolationAlgorithm.cs:9