I would like to make a Buddhabrot style image of the Mandelbulb, but the program I had planned on using to render it (ImageVis3d) does not run on my computer. So far, all I have done is a Matlab script to calculate the data. (I know it's terribly slow. I just use matlab scripts to get the math right before I worry about the details of implemennting it in a real programming language.)
If anyone wants to finish this, I'd love to see the results.
xmin = -2;
xmax = 2;
%ymin = -2;
%ymax = 2;
%zmin = -2;
%zmax = 2;
xres = 256;
%yres = 256;
%zres = 256;
xVoxSize = (xmax-xmin)/xres;
xcenters = (xmin + xVoxSize/2):xVoxSize:(xmax - xVoxSize/2);
A = zeros(xres,yres,zres);
numPoints = 1000;
maxIter = 20;
bailout = 4;
path = zeros(3,0);
for ndx = 1:numPoints
point = rand(3,1)*4 - 2;
p = point;
for mdx = 1:maxIter
p = multiply(p,p);
point = [point,p];
if (p'*p > bailout)
path = [path,point];
continue;
end
end
end
[m,n] = size(path);
for ndx = 1:n
xndx = abs(xcenters-path(1,ndx));
yndx = abs(xcenters-path(2,ndx));
zndx = abs(xcenters-path(3,ndx));
x = find(xndx == min(xndx));
y = find(yndx == min(yndx));
z = find(zndx == min(zndx));
A(x,y,z) = A(x,y,z)+1;
end
A