Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
46
Task/Mandelbrot-set/Icon/mandelbrot-set.icon
Normal file
46
Task/Mandelbrot-set/Icon/mandelbrot-set.icon
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
link graphics
|
||||
|
||||
procedure main()
|
||||
width := 750
|
||||
height := 600
|
||||
limit := 100
|
||||
WOpen("size="||width||","||height)
|
||||
every x:=1 to width & y:=1 to height do
|
||||
{
|
||||
z:=complex(0,0)
|
||||
c:=complex(2.5*x/width-2.0,(2.0*y/height-1.0))
|
||||
j:=0
|
||||
while j<limit & cAbs(z)<2.0 do
|
||||
{
|
||||
z := cAdd(cMul(z,z),c)
|
||||
j+:= 1
|
||||
}
|
||||
Fg(mColor(j,limit))
|
||||
DrawPoint(x,y)
|
||||
}
|
||||
WriteImage("./mandelbrot.gif")
|
||||
WDone()
|
||||
end
|
||||
|
||||
procedure mColor(x,limit)
|
||||
max_color := 2^16-1
|
||||
color := integer(max_color*(real(x)/limit))
|
||||
|
||||
return(if x=limit
|
||||
then "black"
|
||||
else color||","||color||",0")
|
||||
end
|
||||
|
||||
record complex(r,i)
|
||||
|
||||
procedure cAdd(x,y)
|
||||
return complex(x.r+y.r,x.i+y.i)
|
||||
end
|
||||
|
||||
procedure cMul(x,y)
|
||||
return complex(x.r*y.r-x.i*y.i,x.r*y.i+x.i*y.r)
|
||||
end
|
||||
|
||||
procedure cAbs(x)
|
||||
return sqrt(x.r*x.r+x.i*x.i)
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue