|
|
@ -28,8 +28,12 @@ void drawmandelbrot(SDL_Surface *surface) {
|
|
|
|
bool diverges = false;
|
|
|
|
bool diverges = false;
|
|
|
|
float complex z = 0;
|
|
|
|
float complex z = 0;
|
|
|
|
int it;
|
|
|
|
int it;
|
|
|
|
for (it = 1; it < 256; it++) {
|
|
|
|
const int max_it = 170;
|
|
|
|
|
|
|
|
for (it = 1; it <= max_it; it++) {
|
|
|
|
|
|
|
|
/* z = z² + c */
|
|
|
|
z = cpowf(z, 2) + c;
|
|
|
|
z = cpowf(z, 2) + c;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* If |z| ever gets greater than 2, it diverges. */
|
|
|
|
if (cabs(z) > 2) {
|
|
|
|
if (cabs(z) > 2) {
|
|
|
|
diverges = true;
|
|
|
|
diverges = true;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|