Skip to content

Instantly share code, notes, and snippets.

@VentGrey
Created February 11, 2019 17:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VentGrey/14f641b26220957f670f62f9ff540dd7 to your computer and use it in GitHub Desktop.
Save VentGrey/14f641b26220957f670f62f9ff540dd7 to your computer and use it in GitHub Desktop.
mandelbrotjodido.cpp
int value ( int x, int y) {
complex<float> point((float)x/width-1.5, (float)y/height-0.5);
// we divide by the image dimensions to get values smaller than 1
// then apply a translation
complex<float> z(0, 0);
unsigned int nb_iter = 0;
while (abs (z) < 2 && nb_iter <= 34) {
z = z * z + point;
nb_iter++;
}
if (nb_iter < 34) return 255;
else return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment