コード例 #1
0
        public void Wgs84ToMercatorUnity_DistanceTest()
        {
            var wgsToMercatorUnity = new Wgs84ToMercatorUnity();

            var wgsA    = new Coordinates(10, 20);
            var wgsB    = new Coordinates(20, 30);
            var wgsDist = MathUtils.DistanceBetween(wgsA, wgsB);

            var unityDoubleA    = wgsToMercatorUnity.Project(wgsA);
            var unityDoubleB    = wgsToMercatorUnity.Project(wgsB);
            var unityDoubleDist = UnityEngine.Vector3.Distance(unityDoubleA, unityDoubleB);

            Assert.AreEqual(wgsDist, unityDoubleDist);
        }
コード例 #2
0
        public void Wgs84ToMercatorUnity()
        {
            var projector = new Wgs84ToMercatorUnity();
            var actual    = Coordinates.Zero;
            var forward   = projector.Project(actual);
            var back      = projector.InverseProject(forward);
            var backC     = new Coordinates(back);

            Assert.AreEqual(actual, backC);
        }