ウィキペディアの記事で説明されているようにマンデルブロ集合を正常に実装しましたが、特定のセクションにズームインする方法がわかりません。これは私が使用しているコードです:
+(void)createSetWithWidth:(int)width Height:(int)height Thing:(void(^)(int, int, int, int))thing
{
for (int i = 0; i < height; ++i)
for (int j = 0; j < width; ++j)
{
double x0 = ((4.0f * (i - (height / 2))) / (height)) - 0.0f;
double y0 = ((4.0f * (j - (width / 2))) / (width)) + 0.0f;
double x = 0.0f;
double y = 0.0f;
int iteration = 0;
int max_iteration = 15;
while ((((x * x) + (y * y)) <= 4.0f) && (iteration < max_iteration))
{
double xtemp = ((x * x) - (y * y)) + x0;
y = ((2.0f * x) * y) + y0;
x = xtemp;
iteration += 1;
}
thing(j, i, iteration, max_iteration);
}
}
x0は-2.5〜1の範囲にあり、y0は-1〜1の範囲にある必要があり、その数を減らすとズームするというのが私の理解でしたが、実際にはまったく機能しませんでした。どうすればズームできますか?