public double GetHorizontalDistance(Trackpoint b) { var climb = GetClimb(b); var distance = GetDistance(b); if (Math.Abs(climb) < 0.0001) { return(distance); } var factor = climb / distance; // This should not happen in correct (precise) GPX files if (factor > 1) { Debug.WriteLine("The GPX file has to steep sections - it's probably faulty"); factor = 1; } if (factor < -1) { Debug.WriteLine("The GPX file has to steep sections - it's probably faulty"); factor = -1; } return(climb / Math.Tan(Math.Asin(factor))); }
public double GetClimb(Trackpoint b) => b.Coordinate.Altitude - Coordinate.Altitude;
public double GetSlope(Trackpoint b) => GetClimb(b) / GetHorizontalDistance(b);
public double GetDistance(Trackpoint b) => Coordinate.GetDistanceTo(b.Coordinate);