Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        public void FailWithPointAndCoordinatesWithWrongDimension()
        {
            var target = new IdwInterpolator(dimensions: 2, power: 2, numberOfNeighbours: 5);

            target.AddPoint(1, 1, 1, 1); // One dimension too much.
        }
Esempio n. 4
0
        public void FailWithPointAndMissingCoordinates()
        {
            var target = new IdwInterpolator(dimensions: 2, power: 2, numberOfNeighbours: 5);

            target.AddPoint(1, null); // Coordinates missing.
        }
Esempio n. 5
0
        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.
        }
Esempio n. 6
0
        public void FailWithPointAndMissingCoordinates()
        {
            var target = new IdwInterpolator(dimensions: 2, power: 2, numberOfNeighbours: 5);

            Assert.Throws <ArgumentNullException>(() => target.AddPoint(1, null)); // Coordinates missing.
        }