Mandelbrot precision target the center of a pixel?

227 Views Asked by At

I read this question and I don't understand the answer: https://stackoverflow.com/questions/8381675/how-to-perform-simple-zoom-into-mandelbrot-set?rq=1. Especially how can I aim for the center of the pixel like so:

  for(unsigned SX = SMin; x < SMax; ++x) {
     double k = (double(SX + 0.5) - SMin) / (SMax - SMin);
     double IX = (k * (IMax - IMin)) + IMin;
  }

Is k then the real factor and ix the imaginary factor?

I've made an example here: http://www.phpdevpad.de/index.php?id=190 but how can I find the corner pixel when I want to zoom into it like so:

 double Re_factor = (MaxRe-MinRe)/(ImageWidth-1);
 double Im_factor = (MaxIm-MinIm)/(ImageHeight-1);
 double newMinRe = MinRe + (Re_factor* x1);
 double newMaxRe = MinRe + (Re_factor* x2);
 double newMinIm = MinIm + (Im_factor* y1);
 double newMaxIm = MinIm + (Im_factor* y2);

In my example the zoomed image is a bit tall in the y-axis. Why is this?

Update: IX is the x-value in the imaginary space hence my first question is answered.

1

There are 1 best solutions below

2
On BEST ANSWER

I would use Im_factor = Re_factor (assuming square pixels on your screen). In other words, $(MaxRe-MinRe):(MaxIm-MinIm)$ should equal $(ImageWidth-1):(ImageHeight-1)$.