Fhnw.Ecnf.RoutePlanner.RoutePlannerLib.WayPoint.Distance C# (CSharp) 메소드

Distance() 공개 메소드

public Distance ( WayPoint target ) : Double
target WayPoint
리턴 Double
        public Double Distance(WayPoint target)
        {
            double R = 6371;    // earth radius
            double slat = ConvertToRadians(this.Latitude), slong = ConvertToRadians(this.Longitude);
            double tlat = ConvertToRadians(target.Latitude), tlong = ConvertToRadians(target.Longitude);
            double d = R*
                       Math.Acos(Math.Sin(slat)*Math.Sin(tlat) +
                                 Math.Cos(slat) * Math.Cos(tlat) *
                                 Math.Cos(slong - tlong));

            return d;
        }

Usage Example

예제 #1
0
파일: Cities.cs 프로젝트: Lesrac/ecnf_labor
 public List <City> FindNeighbours(WayPoint location, double distance)
 {
     return(CityList
            .Where(c => location.Distance(c.Location) <= distance)
            .OrderBy(c => location.Distance(c.Location))
            .ToList());
 }
All Usage Examples Of Fhnw.Ecnf.RoutePlanner.RoutePlannerLib.WayPoint::Distance