Created
February 11, 2019 17:35
-
-
Save VentGrey/14f641b26220957f670f62f9ff540dd7 to your computer and use it in GitHub Desktop.
mandelbrotjodido.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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