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