Exemplo n.º 1
0
 public void RadiansToAviaticTest()
 {
     Assert.Equal(90, GreatCircle.RadiansToAviatic(0));
     Assert.Equal(0, GreatCircle.RadiansToAviatic(Math.PI / 2.0));
     Assert.Equal(270, GreatCircle.RadiansToAviatic(Math.PI));
     Assert.Equal(270, GreatCircle.RadiansToAviatic(-Math.PI));
     Assert.Equal(180, GreatCircle.RadiansToAviatic(-Math.PI / 2.0));
 }
Exemplo n.º 2
0
        private static void InternalDistDir(GeographicPosition startPosition,
                                            GeographicPosition endPosition,
                                            ref double distance, ref double direction)
        {
            double deltaLat = endPosition.Latitude - startPosition.Latitude;
            double deltaLon = endPosition.Longitude - startPosition.Longitude;
            double deltaX   = deltaLon * GreatCircle.MetersPerDegreeLongitude * Math.Abs(Math.Cos(startPosition.Latitude * Math.PI / 180.0));
            double deltaY   = deltaLat * GreatCircle.MetersPerDegreeeLatitude;

            distance  = Math.Sqrt(deltaX * deltaX + deltaY * deltaY);
            direction = GreatCircle.RadiansToAviatic(Math.Atan2(deltaY, deltaX));
        }