September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
18
Task/Fractal-tree/Zkl/fractal-tree.zkl
Normal file
18
Task/Fractal-tree/Zkl/fractal-tree.zkl
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
fcn fractalTree(){
|
||||
scale:=0.76;
|
||||
sizeX:=400; sizeY:=300;
|
||||
bitmap:=PPM(sizeX*2,sizeY*2,0xFF|FF|FF);
|
||||
branch:='wrap(x1,y1,size,angle,depth){
|
||||
ar:=angle.toRad();
|
||||
x2:=x1 - size*ar.cos();
|
||||
y2:=y1 + size*ar.sin();
|
||||
color:=(0xff-depth*8).shiftLeft(16) + (depth*12+100).shiftLeft(8);
|
||||
bitmap.line(x1,y1, x2,y2, color);
|
||||
if(depth){
|
||||
self.fcn(x2,y2,scale*size,angle - 30,depth - 1,vm.pasteArgs(5));
|
||||
self.fcn(x2,y2,scale*size,angle + 8, depth - 1,vm.pasteArgs(5));
|
||||
}
|
||||
};
|
||||
branch(sizeX,0,sizeY/2,90.0,10);
|
||||
bitmap.write(File("foo.ppm","wb"));
|
||||
}();
|
||||
Loading…
Add table
Add a link
Reference in a new issue