Ejemplo n.º 1
0
 /// <summary>
 /// Return GeoLocation from Radians
 /// </summary>
 /// <param name="latitude">The latitude, in radians.</param>
 /// <param name="longitude">The longitude, in radians.</param>
 /// <returns>GeoLocation in Radians</returns>
 public static GeoLocation FromRadians(double latitude, double longitude)
 {
     GeoLocation result = new GeoLocation
     {
         radLat = latitude,
         radLon = longitude,
         degLat = Helpers.ConvertRadiansToDegrees(latitude),
         degLon = Helpers.ConvertRadiansToDegrees(longitude)
     };
     result.CheckBounds();
     return result;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Computes the great circle distance between this GeoLocation instance and the location argument.
 /// </summary>
 /// <param name="location">Location to act as the centre point</param>
 /// <returns>the distance, measured in the same unit as the radius argument.</returns>
 public double DistanceTo(GeoLocation location)
 {
     return Math.Acos(Math.Sin(radLat) * Math.Sin(location.radLat) +
             Math.Cos(radLat) * Math.Cos(location.radLat) *
             Math.Cos(radLon - location.radLon)) * earthRadius;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Computes the great circle distance between this GeoLocation instance and the location argument.
 /// </summary>
 /// <param name="location">Location to act as the centre point</param>
 /// <returns>the distance, measured in the same unit as the radius argument.</returns>
 public double DistanceTo(GeoLocation location)
 {
     return(Math.Acos(Math.Sin(radLat) * Math.Sin(location.radLat) +
                      Math.Cos(radLat) * Math.Cos(location.radLat) *
                      Math.Cos(radLon - location.radLon)) * earthRadius);
 }