Example #1
0
        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)));
        }
Example #2
0
 public double GetClimb(Trackpoint b) => b.Coordinate.Altitude - Coordinate.Altitude;
Example #3
0
 public double GetSlope(Trackpoint b) => GetClimb(b) / GetHorizontalDistance(b);
Example #4
0
 public double GetDistance(Trackpoint b) => Coordinate.GetDistanceTo(b.Coordinate);