public double?GetElevationDifFrom(GpxPoint other) { if (Elevation == null && other.Elevation == null) { return(null); } return(Elevation - other.Elevation); }
public GpxPointCollection <GpxPoint> ToGpxPoints() { GpxPointCollection <GpxPoint> points = new GpxPointCollection <GpxPoint>(); foreach (T gpxPoint in Points_) { GpxPoint point = new GpxPoint { Longitude = gpxPoint.Longitude, Latitude = gpxPoint.Latitude, Elevation = gpxPoint.Elevation, Time = gpxPoint.Time }; points.Add(point); } return(points); }
public double GetDistanceFrom(GpxPoint other) { double thisLatitude = this.Latitude; double otherLatitude = other.Latitude; double thisLongitude = this.Longitude; double otherLongitude = other.Longitude; double deltaLatitude = Math.Abs(this.Latitude - other.Latitude); double deltaLongitude = Math.Abs(this.Longitude - other.Longitude); thisLatitude *= RADIAN; otherLatitude *= RADIAN; deltaLongitude *= RADIAN; double cos = Math.Cos(deltaLongitude) * Math.Cos(thisLatitude) * Math.Cos(otherLatitude) + Math.Sin(thisLatitude) * Math.Sin(otherLatitude); return(EARTH_RADIUS * Math.Acos(cos > 1 ? 1 : cos)); }