Pythagoras tree: Difference between revisions

Content added Content deleted
m (→‎{{header|Rust}}: syntaxhighlight lang="rust")
Line 413:
[https://easylang.online/apps/_pythagoras-tree.html Run it]
 
<syntaxhighlight lang="text">func tree x1 y1 x2 y2 depth . .
func tree ifx1 y1 x2 y2 depth <. 8.
if dxdepth =< x2 - x18
dy dx = y1x2 - y2x1
x3 dy = x2y1 - dyy2
y3 x3 = y2x2 -+ dxdy
x4 y3 = x1y2 -+ dydx
y4 x4 = y1x1 -+ dxdy
x5 y4 = x4y1 + 0.5 * (dx - dy)
y5 x5 = y4x4 -+ 0.5 * (dx + dy)
color3 0.3 y5 = y4 + 0.25 +* depth(dx /- 18 0.1dy)
polygon [ x1color3 y10.3 x20.2 y2+ x3depth y3/ x418 y4 ]0.1
polygon [ x1 y1 x2 y2 x3 y3 x4 y4 x5 y5 ]
call tree polygon [ x3 y3 x4 y4 x5 y5 depth + 1]
call tree x5x4 y5y4 x3x5 y3y5 depth + 1
call tree x5 y5 x3 y3 depth + 1
.
.
call tree 41 10 59 10 0
color3 0.3 0 0.1
call tree 41 90 59 90 0</syntaxhighlight>
 
=={{header|F_Sharp|F#}}==