Esempio n. 1
0
        private double getDistance(Angle startLatitude, Angle startLongitude, Angle endLatitude, Angle endLongitude, double radius)
        {
            Angle    angularDistance = SMath.ApproxAngularDistance(startLatitude, startLongitude, endLatitude, endLongitude);
            int      steps           = 4;
            double   distance        = 0;
            Vector3d d1 = SMath.SphericalToCartesianV3D(startLatitude.Degrees, startLongitude.Degrees, radius);

            for (int i = 1; i < steps; i++)
            {
                Angle curLat;
                Angle curLon;

                SMath.IntermediateGCPoint((float)i / (float)(steps - 1), startLatitude, startLongitude, endLatitude, endLongitude, angularDistance, out curLat, out curLon);

                Vector3d d2      = SMath.SphericalToCartesianV3D(curLat.Degrees, curLon.Degrees, radius);
                Vector3d segment = d2 - d1;
                distance += segment.Length;
                d1        = d2;
            }

            return(distance);
        }