Make a Mandelbrot set with this script. Best to watch paused in heat mode and with deco on.
Just type mandel(x,y,dx,dy,deco), where x and y are the starting positions and dx and dy are the end positions.
If deco is true you get the image on the right, if its false then you get the image on the left (in heat display)
function mandel(x,y,dx,dy,deco)
dx = dx - x
dy = dy - y
for dx = 1,dx do
c = dx * 4.0 / dx - 2.0
for heigth = 1, dy do
v = heigth * 4.0 / dy - 2.0
iterations = 0
n1 = 0
n2 = 0
while complexAbs(n1,n2) < 4 and iterations < 30 do
n1,n2 = complexMult(n1,n2,n1,n2)
n1,n2 = complexAdd(n1,n2,c,v)
iterations = iterations + 1
end
tpt.create(x + dx,y + heigth,"filt")
tpt.set_property("temp",iterations*300,x + dx, y + heigth)
if bool == true then
s = num2hex(iterations*559240)
tpt.set_property("dcolor","0xFF"..s,x + dx, y + heigth)
end
end
end
end
function complexAbs(r,i)
return r*r+i*i
end
function complexMult(r1,i1,r2,i2)
return r1*r2 - i1*i2, r1*i2 + r2*i1
end
function complexAdd(r1,i1,r2,i2)
return r1+r2, i1+i2
end
The idea of this code comes from Sethling Mandelbrot set filter for Minecraft. Check it out: http://sethbling.com/downloads/mcedit-filters/mandelbrot/
Thanks for the tips. :)