Here is pseudo-code of how I setup an array representing the MandelBrot set, yet it becomes horribly stretched when leaving an aspect ratio of 1:1.
xStep = (maxX - minX) / width; yStep = (maxY - minY) / height; for(i = 0; i < width; i++) for(j = 0; j < height; j++) { constantReal = minReal + xStep * i; constantImag = minImag + yStep * j; image[i][j] = inSet(constantReal, constantImag); }
Thanks!
Aha! It’s because you must keep the same aspect ratio both for the image you will draw and for the region of the complex plane you want to draw. In other words, it must hold
(It follows that xStep == yStep.) Your code probably does not enforce this requirement.