template void Matrix::sinc(T amplitude, float freq, unsigned int zeroX, unsigned int zeroY) { unsigned int pgmMaxValueBak = _pgmMaxValue; for (unsigned int y = 0; y < _size[1]; y++) { for (unsigned int x = 0; x < _size[0]; x++) { double radius = sqrt(pow((double) ((int) x - (int) zeroX), 2) + pow((double) ((int) y - (int) zeroY), 2)); if (radius == 0) { setValue(x, y, 0, amplitude); } else { /* this produces negative values, which will be normalized later */ setValue(x, y, 0, amplitude * (T) (sin(radius) / radius)); } } } _pgmMaxValue = (unsigned int) amplitude; normalize(); _pgmMaxValue = pgmMaxValueBak; }