/// <summary> /// Verifies that the specified 4 points are not rotated - that each point shares either the x or y coordinate with the previous point /// </summary> /// <returns></returns> public static bool IsUnrotated(PointF[] a) { PointF lastPoint = a[a.GetUpperBound(0)]; foreach (PointF p in a) { if (p.X != lastPoint.X && p.Y != lastPoint.Y) return false; lastPoint = p; } return true; }
/// <summary> /// Grabs a single-dimension array from a 2 dimensional array, using the specified primary index. /// </summary> /// <param name="array"></param> /// <param name="index"></param> /// <returns></returns> public static PointF[] GetSubArray(PointF[,] array, int index) { PointF[] sub = new PointF[array.GetUpperBound(1) + 1]; for (int i = 0; i < array.GetUpperBound(1) + 1; i++) sub[i] = array[index, i]; return sub; }