47double Sine_Source::sample()
49 double samp = m + A *
sin(theta);
52 if (theta >= 2.0 *
pi)
62 for (
int i=0;
i < n;
i++)
73 for (
i = 0;
i <
h;
i++)
74 for (
j = 0;
j < w;
j++)
92double Square_Source::sample()
94 double samp = theta < 0.5 ? 1.0 : -1.0;
107 for (
int i=0;
i < n;
i++)
118 for (
i = 0;
i <
h;
i++)
119 for (
j = 0;
j < w;
j++)
137double Triangle_Source::sample()
139 double samp = m + 4.0 * A * (theta < 0.25 ? theta : 0.5 - theta);
152 for (
int i=0;
i < n;
i++)
163 for (
i = 0;
i <
h;
i++)
164 for (
j = 0;
j < w;
j++)
182double Sawtooth_Source::sample()
184 double samp = 2.0 * A * theta;
197 for (
int i=0;
i < n;
i++)
208 for (
i = 0;
i <
h;
i++)
209 for (
j = 0;
j < w;
j++)
226double Impulse_Source::sample()
246 for (
int i=0;
i < n;
i++)
257 for (
i = 0;
i <
h;
i++)
258 for (
j = 0;
j < w;
j++)
276 for (
int i = pat.size() - 1;
i >= 0;
i--) {
278 var += pat(
i) * pat(
i);
285double Pattern_Source::sample()
287 double samp = pat(pos);
289 if (pos >= pat.size() - 1)
301 for (
int i=0;
i < n;
i++)
312 for (
i = 0;
i <
h;
i++)
313 for (
j = 0;
j < w;
j++)
double operator()()
Return a single sample.
Impulse_Source(double freq, double ampl=1.0, double inphase=0.0)
Constructor. Set frequency, amplitude and start phase.
Pattern_Source(const vec &pattern, int start_pos=0)
Constructor. Set pattern and start position.
double operator()()
Return a single sample.
double operator()()
Return a single sample.
Sawtooth_Source(double freq, double mean=0.0, double ampl=1.0, double inphase=0.0)
Constructor. Set frequency, mean, amplitude, and start phase.
Sine_Source(double freq, double mean=0.0, double ampl=1.0, double inphase=0.0)
Constructor. Set frequency, mean, amplitude, and start phase.
double operator()()
Return a single sample.
Square_Source(double freq, double mean=0.0, double ampl=1.0, double inphase=0.0)
Constructor. Set frequency, mean, amplitude, and start phase.
double operator()()
Return a single sample.
double operator()()
Return a single sample.
Triangle_Source(double freq, double mean=0.0, double ampl=1.0, double inphase=0.0)
Constructor. Set frequency, mean, amplitude and start phase.
double mean(const vec &v)
The mean value.
vec sin(const vec &x)
Sine function.
const double pi
Constant Pi.
Deterministic sources - header file.