Created
June 26, 2016 13:12
-
-
Save postspectacular/13ece130bcc31c303064d387d4d6b54d to your computer and use it in GitHub Desktop.
Peter de Jong Strange Attractor
This file contains hidden or 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
(defn compute-dejong | |
"Computes a single DeJong 2d point vector for given params and XY pos" | |
[a b c d x y] | |
(v/vec2 | |
(+ (Math/sin (* a y)) (Math/cos (* (* b x) x))) | |
(+ (Math/sin (* (* c x) x)) (Math/cos (* d y))))) | |
(->> (range 1e6) | |
(reduce | |
(fn [[points [x y]] _] | |
(let [pos (compute-dejong a b c d x y)] | |
[(conj points pos) pos])) | |
[[] [(m/random width) (m/random width)]]) | |
(first)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment