public static Xy FlatTo2DIndex(this Array array, int flattenedIndex) { #if DEV_MODE && PI_ASSERTATIONS var test = Xy.Get2DIndex(array, flattenedIndex); Debug.Assert(test.ToFlattenedIndex(array) == flattenedIndex); #endif return(Xy.Get2DIndex(array, flattenedIndex)); }
/// <summary> /// Where this Size2D represents the width and height of a two-dimensional collection, /// converts given flattened index to height and width indexes of a member in the collection. /// in the collection. /// </summary> /// <param name="flattenedIndex"> Zero-based flattened index of a member in a two-dimensional collection. </param> /// <returns> The two-dimensional index of a member in the collection. </returns> public Xy Get2DIndex(int flattenedIndex) { return(Xy.Get2DIndex(width, flattenedIndex)); }