我的計算似乎是移動圖像比縮放更多。不太確定我要出錯的地方。我以爲我正確地在這裏跟上了另一篇文章,但這不太對。縮放MandelBrot集
int xPos = ev.xbutton.x;
int yPos = ev.xbutton.y;
double xCenter = (double) ((double) ((double) xPos/X_RESN) * (rmax - rmin)) + rmin;
double yCenter = (double) ((double) ((double) yPos/Y_RESN) * (imax - imin)) + imin;
double pixelFactors[4];
if(ev.xbutton.button == 1) //Left click, zoom in
{
rmin = (double) xCenter + (rmin + 0.3);
rmax = (double) xCenter + (rmax - 0.3);
imin = (double) yCenter + (imin + 0.3);
imax = (double) yCenter + (imax - 0.3);
}
else if(ev.xbutton.button == 3) //Right click, zoom out
{
rmin = -2;
rmax = 2;
imin = -2;
imax = 2;
}
你跟隨什麼職位? – Xymostech 2013-04-25 04:22:37
http://stackoverflow.com/questions/8381675/how-to-perform-simple-zoom-into-mandelbrot-set – T3CHN0CR4T 2013-04-25 04:46:59
如果你不想讓它移動,那麼爲什麼涉及'xPos'和'yPos' ? – 2013-04-25 06:00:54