public static void CopyTo <T>(T[] src, IEncodedArray <T> dst, int dstOffset = 0) { for (int i = 0; i < src.Length; ++i) { dst[i + dstOffset] = src[i]; } }
public static void FillFrom <T>(this IEncodedArray <T> dst, int dstIndex, params T[] src) where T : unmanaged { for (int i = 0; i < src.Length; ++i) { dst[dstIndex + i] = src[i]; } }
public static void Copy <T>(IEncodedArray <T> src, ArraySegment <T> dst) { var c = src.Count; for (int i = 0; i < c; ++i) { dst.Array[dst.Offset + i] = src[i]; } }
public static void FillFrom <T>(this IEncodedArray <T> dst, int dstIndex, IEnumerable <T> src) { using (var ator = src.GetEnumerator()) { while (dstIndex < dst.Count && ator.MoveNext()) { dst[dstIndex++] = ator.Current; } } }
public SparseArray(IEncodedArray <T> bottom, IEncodedArray <T> top, IntegerArray topMapping) { _BottomItems = bottom; _TopItems = top; _Mapping = new Dictionary <int, int>(); for (int val = 0; val < topMapping.Count; ++val) { var key = (int)topMapping[val]; _Mapping[key] = val; } }
public static (Vector4, Vector4) GetBounds(IEncodedArray <Vector4> accesor) { var min = new Vector4(Single.MaxValue); var max = new Vector4(Single.MinValue); int c = accesor.Count; for (int i = 0; i < c; ++i) { var v = accesor[i]; min = Vector4.Min(min, v); max = Vector4.Max(max, v); } return(min, max); }
public EncodedArrayEnumerator(IEncodedArray <T> accessor) { this._Accessor = accessor; this._Count = accessor.Count; this._Index = -1; }
public static void Copy <T>(IEncodedArray <T> src, T[] dst) { Copy <T>(src, new ArraySegment <T>(dst)); }