我对 Mandelbrot 设置“缩放”视图和与之相关的数学有一个一般性的问题。我已经用值实现了 256 X 256 窗口大小的 mandelbrot 集
// ImageWidth = ImageHeight = 256;
double MinRe = -2.0;
double MaxRe = 1.0;
double MinIm = -1.2;
double MaxIm = 1.8;
ComputeMandelbrot();
接下来,我选择一个正方形区域,这些是最左上角 (76,55) 和最右下角 (116, 99) 的坐标(选择 44 边的正方形)
所以,我选择x2 = x1 + 44 ; y2 = y1 + 44;
如何将这些新坐标转换为复平面?以及新的实值和虚值将如何变化以便为新值集计算它?
这是我到目前为止所尝试的..
double Re_factor = (MaxRe-MinRe)/(ImageWidth-1);
double Im_factor = (MaxIm-MinIm)/(ImageHeight-1);
double newMinRe = MinRe + (Re_factor* x1);
double newMaxRe = MaxRe + (Re_factor* x2);
double newMinIm = MinIm + (Im_factor* y1);
double newMaxIm = MaxIm + (Im_factor* y2);
// and then I compute c - real and c- imag values
for(unsigned y=0; y<ImageHeight; ++y)
{
double c_im = newMaxIm - y*Im_factor;
for(unsigned x=0; x<ImageWidth; ++x)
{
double c_re = newMinRe + x*Re_factor;
// ComputeMandelbrot();
}
}
我很难弄清楚数学,还有关于生成“缩放”视图,感谢任何帮助!