/// <summary> /// Returns the minimum coordinate, using the usual lexicographic comparison. /// </summary> /// <param name="coordinates">Array to search.</param> /// <returns>The minimum coordinate in the array, found using <c>CompareTo</c>.</returns> public static ICoordinate MinCoordinate(ICoordinate[] coordinates) { ICoordinate minCoord = null; for (int i = 0; i < coordinates.Length; i++) { if (minCoord == null || minCoord.CompareTo(coordinates[i]) > 0) { minCoord = coordinates[i]; } } return(minCoord); }
/// <summary> /// Determines whether two <see cref="Coordinate" /> arrays of equal length /// are equal in opposite directions. /// </summary> /// <param name="pts1"></param> /// <param name="pts2"></param> /// <returns></returns> private static bool IsEqualReversed(ICoordinate[] pts1, ICoordinate[] pts2) { for (int i = 0; i < pts1.Length; i++) { ICoordinate p1 = pts1[i]; ICoordinate p2 = pts2[pts1.Length - i - 1]; if (p1.CompareTo(p2) != 0) { return(false); } } return(true); }