public double DistanceBetween_Meters(TrackPointGpx other) { double flatDistanceMeters = DistanceBetween_Flat_Meters(other); double zDistanceMeters = Math.Abs(this.Elevation.ElevationMeters - other.Elevation.ElevationMeters); return(Math.Sqrt(Math.Pow(flatDistanceMeters, 2) + Math.Pow(zDistanceMeters, 2))); }
// Returns the distance between this track point and another in meters // taking into account only the delta in x and y coordinates (changes in // latitude and longitude only... elevation deltas not considered here) public double DistanceBetween_Flat_Meters(TrackPointGpx other) { double xDistanceMeters = Math.Abs(this.GeoCoord.Longitude - other.GeoCoord.Longitude) * ConstantsRt.DEGREES_LONGITUDE_TO_METERS; double yDistanceMeters = Math.Abs(this.GeoCoord.Latitude - other.GeoCoord.Latitude) * ConstantsRt.DEGREES_LATITUDE_TO_METERS; // Hypotenuse of triangle: a^2 + b^2 = c^2, where c is hypotenuse; then solve for c return(Math.Sqrt(Math.Pow(xDistanceMeters, 2) + Math.Pow(yDistanceMeters, 2))); }
public TrackSegmentGpx ReadTrackSegmentGpx() { TrackSegmentGpx seg = new TrackSegmentGpx(); ++_lineNumber; string nextToken = IdentifyToken(); while (nextToken == "trkpt") { TrackPointGpx point = ReadTrackPointGpx(); seg.AddTrackPointGpx(point); nextToken = IdentifyToken(); } return(seg); }