Hi guys!
I want to do a fractalzoom into the mandelbrot fractal. The basic idea was to produce all single plot pictures, and then display/animate the zoom by iterate through the list. But I cant find a solution that really works. Any help would be very appreciated :)
So where am I? A single picture is made like this: (Sorry math tool didnt take it)
plot3d(0, -2 .. 1, -1.5 .. 1.5, orientation = [-90, 0], grid = [250, 250], style = patchnogrid, color = mandelbrot, lightmodel = None):
As u can see, I use the colorfunc property to color the plane. The mandelbrot procedure evalueates how many iterations are needed to go beyond 2 (> 2).
I cant post pictures, so heres the code if u want to reproduce some:
mandelbrot := proc (x, y)
local c, z, iterationCount, position, iterations;
z := 0; iterations := 0; iterationCount := 35;
position := Complex(x, y);
c := evalf(position);
while iterations < iterationCount do
if 2 <= abs(z) then return iterations;
else z := z^2+c; iterations := iterations+1;
end if
od;
return iterations
end:
As you can see i get a list of PLOT3D structures, each with different axis sizes or views. The problem now is when i use the straightforward way:
display(plots, insequence=true);
the animated frames get smaller and smaller, because the frame is set to the same size as the first frame.
Do you have any idea how I can make the axis somewhat dynamic, or do you see a better approach?
Here's the rest of the code to produce the effect. Its nearly hardcoded, because its still in experimental phase, sorry for that :P
The test does the following: Start with window -2 .. 1, -1.5 .. 1.5 and with linear interpolation zoom in to the window -0.82 .. -0.7, -0.2 .. -0.08.
v is used to store the view explicitely, is explained afterwards
steps := 3:
d1 := (2-0.82)/steps:
d2 := (1+0.7)/steps:
d3 := (1.5-0.2)/steps:
d4 := (1.5+0.08)/steps:
l := Array(1 .. 4):
v := Array(1 .. 4):
for i from 0 to steps do
v(i+1) := [d1*i-2 .. -d2*i+1, -1.5+d3*i .. 1.5-d4*i, 0 .. 0];
l(i+1) := plot3d(0, d1*i-2 .. -d2*i+1, -1.5+d3*i .. 1.5-d4*i, orientation = [-90, 0], grid = [100, 100], style = patchnogrid, color = mandelbrot, lightmodel = None);
od:
display a single picture:
display(l(4));
create the animation:
ll := convert(l, list):
display(ll, insequence = true);
Another approach:
I tried to explicitely give the view as argument:
display(l(i), view = v(i)), v(i) stored in previous render loop. This works, but then the question to resolve is how to draw each frame into the same plot figure and not creating a new plot window for each one?
Now you should have all informations, any help is very welcome!
Thanks in advance,
Cheers,
geischtli
