public void TestWeightedInterpolation() { var target = new IdwInterpolator(dimensions: 2, power: 2, numberOfNeighbours: 4); foreach (var point in _pointRange) { target.AddPoint(point.Value, point.Coordinates); // Test adding bare values. } var result = target.Interpolate(1.5, 1.5); Assert.AreEqual(2.875, result.Value, 0.001); Assert.AreEqual(InterpolationResult.ResultOptions.Interpolated, result.Result); Assert.IsNull(result.Point); }
public void TestNearestNeighbourInterpolation() { var target = new IdwInterpolator(dimensions: 2, power: 2, numberOfNeighbours: 1); foreach (var point in _pointRange) { target.AddPoint(point); // Test adding points. } var result = target.Interpolate(1.1, 1.1); Assert.AreEqual(2.2, result.Value); Assert.AreEqual(1, result.Point.Value.Coordinates[0]); Assert.AreEqual(1, result.Point.Value.Coordinates[1]); Assert.AreEqual(InterpolationResult.ResultOptions.NearestNeighbor, result.Result); }
public void FailWithPointAndCoordinatesWithWrongDimension() { var target = new IdwInterpolator(dimensions: 2, power: 2, numberOfNeighbours: 5); target.AddPoint(1, 1, 1, 1); // One dimension too much. }
public void FailWithPointAndMissingCoordinates() { var target = new IdwInterpolator(dimensions: 2, power: 2, numberOfNeighbours: 5); target.AddPoint(1, null); // Coordinates missing. }
public void FailWithPointAndCoordinatesWithWrongDimension() { var target = new IdwInterpolator(dimensions: 2, power: 2, numberOfNeighbours: 5); Assert.Throws <ArgumentException>(() => target.AddPoint(1, 1, 1, 1)); // One dimension too much. }
public void FailWithPointAndMissingCoordinates() { var target = new IdwInterpolator(dimensions: 2, power: 2, numberOfNeighbours: 5); Assert.Throws <ArgumentNullException>(() => target.AddPoint(1, null)); // Coordinates missing. }