Exemplo n.º 1
0
        public void TestNormLon()
        {
            var lons = new double[][]
            {
                new double[] { 1.23, 1.23 },
                //1.23 might become 1.2299999 after some math and we want to ensure that doesn't happen
                new double[] { -180, -180 },
                new double[] { 180, +180 },
                new double[] { 0, 0 },
                new double[] { -190, 170 },
                new double[] { 181, -179 },
                new double[] { -180 - 360, -180 },
                new double[] { -180 - 720, -180 },
                new double[] { 180 + 360, +180 },
                new double[] { 180 + 720, +180 }
            };

            foreach (var pair in lons)
            {
                CustomAssert.EqualWithDelta( /*"input "+pair[0],*/
                    pair[1], DistanceUtils.NormLonDEG(pair[0]), Double.Epsilon);
            }

            var random = new Random(RandomSeed.Seed());

            for (int i = -1000; i < 1000; i += random.Next(9) * 10)
            {
                double d = DistanceUtils.NormLonDEG(i);
                Assert.True(d >= -180 && d <= 180, i + " " + d);
            }
        }
Exemplo n.º 2
0
        public void TestNormLat()
        {
            var lats = new double[][]
            {
                new double[] { 1.23, 1.23 },
                //1.23 might become 1.2299999 after some math and we want to ensure that doesn't happen
                new double[] { -90, -90 },
                new double[] { 90, 90 },
                new double[] { 0, 0 },
                new double[] { -100, -80 },
                new double[] { -90 - 180, 90 },
                new double[] { -90 - 360, -90 },
                new double[] { 90 + 180, -90 },
                new double[] { 90 + 360, 90 },
                new double[] { -12 + 180, 12 }
            };

            foreach (var pair in lats)
            {
                CustomAssert.EqualWithDelta( /* "input "+pair[0],*/
                    pair[1], DistanceUtils.NormLatDEG(pair[0]), Double.Epsilon);
            }
            var random = new Random(RandomSeed.Seed());

            for (int i = -1000; i < 1000; i += random.Next(9) * 10)
            {
                double d = DistanceUtils.NormLatDEG(i);
                Assert.True(/*i + " " + d,*/ d >= -90 && d <= 90);
            }
        }
Exemplo n.º 3
0
 protected AbstractTestShapes(SpatialContext ctx)
 {
     random   = new Random(RandomSeed.Seed());
     this.ctx = ctx;
 }
Exemplo n.º 4
0
 protected AbstractTestShapes()
 {
     random = new Random(RandomSeed.Seed());
 }