static public IEnumerable <Tuple <int, int, RectF2> > GetCroppedGridChunkInfos(this RectF2 item, VectorF2 cell_size) { int width_in_cells = Mathq.CeilToInt(item.GetWidth() / cell_size.x); int height_in_cells = Mathq.CeilToInt(item.GetHeight() / cell_size.y); for (int y = 0; y < height_in_cells; y++) { for (int x = 0; x < width_in_cells; x++) { yield return(Tuple.New(x, y, item.GetCroppedGridChunk(x, y, cell_size))); } } }
static public IEnumerable <T> SubdividePathToLength <T>(this IEnumerable <T> item, float maximum_inter_length, Operation <float, T, T> distance_operation, Operation <T, T, T, float> interpolate_operation) { return(item.ConvertConnections(delegate(T sub_item1, T sub_item2) { float length = distance_operation(sub_item1, sub_item2); if (length > maximum_inter_length) { int number_divisions = Mathq.CeilToInt(length / maximum_inter_length); return Floats.Line(0.0f, 1.0f, number_divisions, false) .Convert(f => interpolate_operation(sub_item1, sub_item2, f)); } return sub_item1.WrapAsEnumerable(); })); }