Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
23
Task/Julia-set/Zkl/julia-set.zkl
Normal file
23
Task/Julia-set/Zkl/julia-set.zkl
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
fcn juliaSet{
|
||||
w,h,zoom:=800,600, 1;
|
||||
bitmap:=PPM(w,h,0xFF|FF|FF); // White background
|
||||
|
||||
cX,cY:=-0.7, 0.27015;
|
||||
moveX,moveY:=0.0, 0.0;
|
||||
maxIter:=255;
|
||||
|
||||
foreach x,y in (w,h){
|
||||
zx:=1.5*(x - w/2)/(0.5*zoom*w) + moveX;
|
||||
zy:=1.0*(y - h/2)/(0.5*zoom*h) + moveY;
|
||||
i:=maxIter;
|
||||
while(zx*zx + zy*zy < 4 and i > 1){
|
||||
tmp:=zx*zx - zy*zy + cX;
|
||||
zy,zx=2.0*zx*zy + cY, tmp;
|
||||
i-=1;
|
||||
}
|
||||
// convert byte to RGB (3 bytes), kinda magic to get nice colors
|
||||
bitmap[x,y]=i.shiftLeft(21) + i.shiftLeft(10) + i*8;
|
||||
}
|
||||
|
||||
bitmap.writeJPGFile("juliaSet.jpg",True);
|
||||
}();
|
||||
Loading…
Add table
Add a link
Reference in a new issue