1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 05:47:35 +00:00

Mandelbrot: Use renormalized fractional iteration count to smooth colors

This commit is contained in:
ronak69 2023-10-21 11:11:38 +00:00 committed by Andreas Kling
parent 225ed58f7e
commit fa026df892

View file

@ -106,8 +106,13 @@ public:
if (iteration == max_iterations) if (iteration == max_iterations)
return iteration; return iteration;
auto lz = sqrt(x * x + y * y) / 2; // Renormalized fractional iteration count from https://linas.org/art-gallery/escape/escape.html
return 1 + iteration + log(lz / log(2)) / log(2); // mu = n + 1 - log( log |Z(n)| ) / log(2)
auto lz = log(sqrt(x2 + y2));
auto mu = iteration + 1 - log(lz) / log(2);
if (mu < 0)
mu = 0;
return mu;
} }
static double linear_interpolate(double v0, double v1, double t) static double linear_interpolate(double v0, double v1, double t)