 | GeneratorWindowTSource Method |
Makes a generator that generates a moving window of elements over a given generator.
Namespace:
Gamelogic.Extensions.Algorithms
Assembly:
Assembly-CSharp (in Assembly-CSharp.dll) Version: 0.0.0.0
Syntax
Exceptions
Examples
In the following example,
var generator = Generator.Count(4).Window(2);
the generator will generate (0 1) (1 2) (2 3) (3 0) (0 1)... The window of
size 2 move one element (of the original generator) at a time.
The following is an implementation of a box blur on the given sequence:
public static IGenerator<float> BoxBlur(IGenerator<float> generator)
{
return generator.Window(3).Select(w => (w[0] + w[1] + w[2])/3f);
}
See Also