Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/22/12 19:14:33 (12 years ago)
Author:
spimming
Message:

#1894:

  • extended datasource interface to get routing graph for a specific vehicle type
  • use ICostCalculator to calculate edge weights
  • moved common enums in own file
  • removed method to estimate cost from graph; use ICostCalculator
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/RoutePlanning/HeuristicLab.Problems.RoutePlanning/3.3/Utilities/Utils.cs

    r8516 r8520  
    1717
    1818    public static double LocationDistance(PointD p1, PointD p2) {
     19      return LocationDistance(p1.X, p1.Y, p2.X, p2.Y);
     20    }
     21
     22    // calculates the distance of the 2 given locations in kilometers
     23    public static double LocationDistance(double startX, double startY, double endX, double endY) {
    1924      // The Haversine formula
    2025      /* dlon = lon2 - lon1
     
    2530       */
    2631
    27       double lat1Rad = p1.Y * (Math.PI / 180.0);
    28       double long1Rad = p1.X * (Math.PI / 180.0);
    29       double lat2Rad = p2.Y * (Math.PI / 180.0);
    30       double long2Rad = p2.X * (Math.PI / 180.0);
     32      double lat1Rad = startY * (Math.PI / 180.0);
     33      double long1Rad = startX * (Math.PI / 180.0);
     34      double lat2Rad = endY * (Math.PI / 180.0);
     35      double long2Rad = endX * (Math.PI / 180.0);
    3136
    3237      double longitude = long2Rad - long1Rad;
     
    3944      double c = 2.0 * Math.Asin(Math.Sqrt(a));
    4045
    41       const double earthRadiusKms = 6376.5;
     46      const double earthRadiusKms = 6367.5;
    4247      double distance = earthRadiusKms * c;
    4348
Note: See TracChangeset for help on using the changeset viewer.