Пример #1
0
        public Slope GetMaxSlope(List <GeoPoint> line)
        {
            Slope max = Slope.Zero;

            for (int i = 1; i < line.Count; i++)
            {
                Slope segmentSlope = ComputeSlope(line[i - 1], line[i]);
                if (segmentSlope > max)
                {
                    max = segmentSlope;
                }
            }
            return(max);
        }
Пример #2
0
        public Slope ComputeSlope(GeoPoint a, GeoPoint b)
        {
            if (a == null || b == null)
            {
                return(Slope.Zero);
            }

            double run = b.DistanceFromOriginMeters.Value - a.DistanceFromOriginMeters.Value;

            if (run <= double.Epsilon || !a.Elevation.HasValue || !b.Elevation.HasValue)
            {
                return(Slope.Zero);
            }

            double rise = b.Elevation.Value - a.Elevation.Value;

            return(Slope.FromRiseRun(rise, run));
        }