/// <summary>
        /// Returns the minimum coordinate, using the usual lexicographic comparison.
        /// </summary>
        /// <param name="seq">The coordinate sequence to search</param>
        /// <returns>The minimum coordinate in the sequence, found using <see cref="Coordinate.CompareTo(Coordinate)"/></returns>
        public static Coordinate MinCoordinate(CoordinateSequence seq)
        {
            Coordinate minCoord = null;

            for (int i = 0; i < seq.Count; i++)
            {
                var testCoord = seq.GetCoordinate(i);
                if (minCoord == null || minCoord.CompareTo(testCoord) > 0)
                {
                    minCoord = testCoord;
                }
            }
            return(minCoord);
        }
        /// <summary>
        /// Returns the index of the minimum coordinate of a part of
        /// the coordinate sequence (defined by <paramref name="from"/>
        /// and <paramref name="to"/>), using the usual lexicographic
        /// comparison.
        /// </summary>
        /// <param name="seq">The coordinate sequence to search</param>
        /// <param name="from">The lower search index</param>
        /// <param name="to">The upper search index</param>
        /// <returns>The index of the minimum coordinate in the sequence, found using <see cref="Coordinate.CompareTo(Coordinate)"/></returns>
        public static int MinCoordinateIndex(CoordinateSequence seq, int from, int to)
        {
            int        minCoordIndex = -1;
            Coordinate minCoord      = null;

            for (int i = from; i <= to; i++)
            {
                var testCoord = seq.GetCoordinate(i);
                if (minCoord == null || minCoord.CompareTo(testCoord) > 0)
                {
                    minCoord      = testCoord;
                    minCoordIndex = i;
                }
            }
            return(minCoordIndex);
        }
Ejemplo n.º 3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="n"></param>
 /// <returns></returns>
 public Coordinate GetCoordinateN(int n)
 {
     return(_points.GetCoordinate(n));
 }
Ejemplo n.º 4
0
 public override Coordinate GetCoordinate(int i) => _inner.GetCoordinate(Count - i - 1);