• Create Account

### #Actualfir

Posted 07 February 2014 - 01:10 AM

As everyone suspected, it's just a Moiré pattern. Here's my attempt at producing it:

#include <cstdio>
#include <cmath>

int main() {
std::puts("# ImageMagick pixel enumeration: 800,800,255,srgb");

for (int j=0; j<800; ++j) {
double y = (400.0 - j) / 360.0;
for (int i=0; i<800; ++i) {
double x = (i - 400.0) / 360.0;
double z2 = 1.0 - x * x - y * y;
double distance = (z2 >= 0.0) ? std::sqrt(z2) : 0.0;
double color = std::fmod(1000.0*distance, 1.0);
int r = 256 * color;
int g = 256 * color;
int b = 256 * (1.0 - color);
r = r > 255 ? 255 : r < 0 ? 0 : r;
g = g > 255 ? 255 : g < 0 ? 0 : g;
b = b > 255 ? 255 : b < 0 ? 0 : b;
std::printf("%d,%d: (%d,%d,%d)  #%02X%02X%02X  srgb(%d,%d,%d)\n",
i, j,
r, g, b,
r, g, b,
r, g, b);
}
}
}



I compiled that code and then executed it, passing the output through | convert TXT:- output.png' (convert' is a command-line utility, part of ImageMagick). The output is this:

[EDIT: If you replace 1000.0 with something like 250.0, you'll get an image much closer to the original in this thread.]

Very good work! I see the central part is probably

distance = sqrt(1-(x*x+y*y))

do you know maybe what klind of function it is id drawed z=f(x,y)

of just z=f(x,0); ?

Im rarely doing mathematics so i forgot the thing

As to moire pattern I suspect this could be treated set of infinite number of moire interferentions - but those interferentions are purely mathematical not 'presentation aliasing' artifacts

### #1fir

Posted 07 February 2014 - 01:06 AM

As everyone suspected, it's just a Moiré pattern. Here's my attempt at producing it:

#include <cstdio>
#include <cmath>

int main() {
std::puts("# ImageMagick pixel enumeration: 800,800,255,srgb");

for (int j=0; j<800; ++j) {
double y = (400.0 - j) / 360.0;
for (int i=0; i<800; ++i) {
double x = (i - 400.0) / 360.0;
double z2 = 1.0 - x * x - y * y;
double distance = (z2 >= 0.0) ? std::sqrt(z2) : 0.0;
double color = std::fmod(1000.0*distance, 1.0);
int r = 256 * color;
int g = 256 * color;
int b = 256 * (1.0 - color);
r = r > 255 ? 255 : r < 0 ? 0 : r;
g = g > 255 ? 255 : g < 0 ? 0 : g;
b = b > 255 ? 255 : b < 0 ? 0 : b;
std::printf("%d,%d: (%d,%d,%d)  #%02X%02X%02X  srgb(%d,%d,%d)\n",
i, j,
r, g, b,
r, g, b,
r, g, b);
}
}
}



I compiled that code and then executed it, passing the output through | convert TXT:- output.png' (convert' is a command-line utility, part of ImageMagick). The output is this:

[EDIT: If you replace 1000.0 with something like 250.0, you'll get an image much closer to the original in this thread.]

Very good work! I see the central part is probably

distance = sqrt(1-(x*x+y*y))

do you know maybe what klind of function it is id drawed z=f(x,y)

of just z=f(x,0); ?

Im rarely doing mathematics so i forgot the thing

PARTNERS