Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
25
Task/Fractal-tree/J/fractal-tree.j
Normal file
25
Task/Fractal-tree/J/fractal-tree.j
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
require'gl2'
|
||||
coinsert'jgl2'
|
||||
|
||||
L0=: 50 NB. initial length
|
||||
A0=: 1r8p1 NB. initial angle: pi divided by 8
|
||||
dL=: 0.9 NB. shrink factor for length
|
||||
dA=: 0.75 NB. shrink factor for angle
|
||||
N=: 14 NB. number of branches
|
||||
|
||||
L=: L0*dL^1+i.N NB. lengths of line segments
|
||||
|
||||
NB. relative angles of successive line segments
|
||||
A=: A0*(dA^i.N) +/\@:*("1) _1 ^ #:i.2 ^ N
|
||||
|
||||
NB. end points for each line segment
|
||||
P=: 0 0+/\@,"2 +.*.inv (L0,0),"2 L,"0"1 A
|
||||
|
||||
wd {{)n
|
||||
pc P closeok;
|
||||
setp wh 480 640;
|
||||
cc C isidraw flush;
|
||||
pshow;
|
||||
}}
|
||||
|
||||
gllines <.(10 + ,/"2 P-"1<./,/P)
|
||||
Loading…
Add table
Add a link
Reference in a new issue