MCPcopy Create free account
hub / github.com/Theverat/NormalmapGenerator / boxesForGauss

Method boxesForGauss

src_generators/gaussianblur.cpp:49–68  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47}
48
49std::vector<double> GaussianBlur::boxesForGauss(double sigma, int n) {
50 double wIdeal = sqrt((12 * sigma * sigma / n) + 1);
51 int wl = floor(wIdeal);
52
53 if(wl % 2 == 0)
54 wl--;
55
56 const int wu = wl + 2;
57
58 const double mIdeal = (12 * sigma * sigma - n * wl * wl - 4 * n * wl - 3 * n) / (-4 * wl - 4);
59 const int m = round(mIdeal);
60
61 std::vector<double> sizes;
62
63 for(int i = 0; i < n; i++) {
64 sizes.push_back(i < m ? wl : wu);
65 }
66
67 return sizes;
68}
69
70void GaussianBlur::boxBlur(IntensityMap &input, IntensityMap &result, double radius, bool tileable) {
71 for(int i = 0; i < input.getWidth() * input.getHeight(); i++) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected