Table of Contents

Method OpenSawTooth

Namespace
Gamelogic.Extensions.Algorithms
Assembly
Gamelogic.Extensions.dll

OpenSawTooth(int)

Makes a generator that produces evenly spaced floats from 0 (included) to 1 (excluded), and repeats the result.

public static IGenerator<float> OpenSawTooth(int sampleCount)

Parameters

sampleCount int

The number of samples per cycle.

Returns

IGenerator<float>

A new generator.

Remarks

This generator is designed to be used with Select<TSource, TResult>(IGenerator<TSource>, Func<TSource, TResult>) to generate outputs of periodic functions.

var generator = Generator.OpenSawTooth(100).Select(x => Math.Sin(2*Math.PI * x));

Exceptions

ArgumentOutOfRangeException

sampleCountis not positive.

OpenSawTooth(IGenerator<int>)

Makes a generator that produces evenly spaced floats from 0 (included) to 1 (excluded), and repeats the result (but with the number of samples each time given by a generator).

public static IGenerator<float> OpenSawTooth(IGenerator<int> sampleCount)

Parameters

sampleCount IGenerator<int>

The number of samples per cycle.

Returns

IGenerator<float>

A new generator.

Remarks

This generator is designed to be used with Select<TSource, TResult>(IGenerator<TSource>, Func<TSource, TResult>) to generate outputs of periodic functions.

Exceptions

ArgumentOutOfRangeException

sampleCountis not positive.