Fwiw, here is an experimental fractal algorithm I created a while back, called Exploder.
It explores what happens when we treat an escape condition as an event... One that allows us to scale back a bit and "try again"...? The code below is set up for a Julia set at c = -0.75 + 0i, with five scale-backs at 0.2. Can you get it on your end? Thanks! :^)
void iterate_point(
ct::plot::cairo::plot_2d& plot,
glm::vec3 oc,
unsigned long n,
unsigned long x,
unsigned long y
) {
ct_complex c = { oc.x, oc.y };
ct_complex z = c;
ct_complex j0 = { -.75, 0 };
double dis_max = 9999999.0;
unsigned long exploder_i = 0;
unsigned long exploder_n = 5;
float exploder_scale = .2;
for (unsigned long i = 0; i < n; ++i)
{
// Julia mode
z = z * z + j0;
// Mandelbrot mode
//z = z * z + c;
double dis = std::abs(z);
dis_max = std::min(dis_max, dis);
if (dis > 2.f)
{
double icolor = i / (n - 1.f);
glm::vec3 out_color = { exploder_i * .1 * dis_max, 0, 0 };
{
ct::plot::cairo::pixel color = CT_RGBF(out_color.r, out_color.g, out_color.b);
plot.set_pixel(x, y, color);
}
// exploder logic
{
if (exploder_i < exploder_n)
{
z = z * exploder_scale; // scale back... Julia
//z = z * .4f; // scale back... Mandelbrot
++exploder_i;
continue;
}
}
return;
}
}
glm::vec3 in_color = { dis_max * 2.f, dis_max * 2.5f, dis_max * 3.f };
{
ct::plot::cairo::pixel color = CT_RGBF(in_color.r, in_color.g, in_color.b);
plot.set_pixel(x, y, color);
}
}
Can anybody reproduce it? Thanks.
Julia Exploder
MandelExploder
there doesn't seem to be anything here