  BuddhaZoom

Note: I've developed a technique and a quick zooming applet since I wrote this section, so part of the info presented here is now not that valuable.

The technique to enlarge a region

In order to zoom on the Mandelbrot fractal, it's enough to examine only Cs inside the enlarged region.

However, this technique is no use for the Buddhabrot, because we're painting Zs for a given C, which means that we should calculate all trajectories anyway. Not only that, but we'll also have to check more Cs so as not to lose "resolution". We should then define the region to magnify, and count only Zs that fall inside.

On the coding level, we need to know where that regino is on the complex plane. On the following snippet, i've implemented an example from Melinda Green's The Buddhabrot Technique. It's a zoom on the "third eye" on the buddha's forehead.

```    // Vars to limit the magnified region on the complex plane.
float xMin    = -1.2125f;

float xMax    = -1.0875f;
float yMin    = -0.0625f;
float yMax    = 0.0625f;
float factor  = (lado - 1) / (xMax - xMin);
for (Cr = -2; Cr < 2; Cr += increm) for (Ci = -2; Ci < 2; Ci += increm) {
...
if (n < maxN)
for (i = 0; i < n; i++) {
if (trayectoria[i] < xMin || trayectoria[i] > xMax ||
trayectoria[i] < yMin || trayectoria[i] > yMax)
continue;
coordX = (int)((trayectoria[i] - xMin) * factor);
coordY = (int)((trayectoria[i] - yMin) * factor);
pixels[coordX][coordY]++;
}
}```

Additionally, `increm` must decrease proportionally to the "magnifications", or else we'll get a scarcely detailed image.

It might be worth it to mention how I determined `increm` on the examples so far (no zoom):

• Based on the final image's size; so far it was a 1000x1000 pixels picture.
• I said before that checking 100 Cs per pixel yielded smooth images; then for (1000x1000) a million pixels, we've checked a grand total of 100 million Cs!
• Being the complex plane in question a square, we can tell how many Cs to inspect per axis calculating the square root of the total of Cs per pixel (sqrt 100 = 10), and multiplying that value by the image's side (10 * 1000): 10000 Cs per axis.
• Now we just have to divide the side of the complex plane by the Cs per axis: `increm = 4 / 10000 = 0.0004`.

On the example, the magnified region is a side 0.125 square (`xMax` - `xMin` = `yMax` - `yMin`); if we calculate the zoom (4 / 0.125), we get 32x. Still with a 1000x1000 image, we multiply the magnifications by the total number of Cs on both axis (320000 * 320000): we'll have to check 1.024x1011 Cs on the plane!! ):,O That results in `increm = 4 / 320000 = 0.0000125`.

Let me make this clear: this formula is just my subjective criteria, maybe some people will check more Cs, and others will make do with less -it's an aesthetic question. In fact, the BuddhaBrot technique's creator doesn't "sweep" the complex plane as I do. What she does is choose random Cs, and when she thinks it's enough, save the image. Personally, I think on the final result it is hard to tell the difference, only her technique is far slower just because generating a random number takes more time than a sum.

That said, don't even think about trying the above example: you have the computer hugged days or weeks, depending on your machine. It's more than a hundrer billion Cs to inspect, and a very significant part of them wil iterate the Mandelbrot function to `maxN`! It's mental!! We can't have that... Skip to next page if you want to know how to optimize this -inefficient- code: this zoom can get done in a few hours instead of a few days!

These pictures are the magnified region in the example. Each gray-scale image takes a color channel, and merging them produces the last one.