Interpolation with test done

This commit is contained in:
Иван Ивашкин
2024-10-31 17:35:31 +05:00
parent 96b0fbd6a3
commit bcea9639f6
12 changed files with 130 additions and 24 deletions

View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StructureHelperCommon.Services
{
public static class MathUtils
{
public static double Interpolation(double x, double x1, double x2, double y1, double y2)
{
if (Math.Abs(x2 - x1) < 10E-3)
{
return (y1 + y2) / 2;
}
var y = (y2 - y1) * (x - x1) / (x2 - x1) + y1;
return y;
}
}
}