Created
November 21, 2022 02:27
-
-
Save jdh30/5977c4dfa7c89748c195d4418b20507b to your computer and use it in GitHub Desktop.
Iterative Fractal System Fern
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let ff ((rx, ry), i) = | |
if i=3000 then None else | |
let ((a,b),(c,d)), (vx,vy) = | |
let r = Random.next 100 in | |
if r < 75 then ((85, 4), (-4, 85)), (0, 160) | |
else if r < 88 then ((-15, 28), (-26, 24)), (0, 44) | |
else if r < 98 then ((20, -26), (23, 22)), (0, 160) | |
else ((0, 0), (0, 16)), (0, 0) in | |
Some((rx, ry), (((a*rx+b*ry+vx)/100, (c*rx+d*ry+vy)/100), i+1)) | |
let () = Array.unfold ff ((0,0), 0) @ Chart.scatter "" "" "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment