Created
November 24, 2009 12:58
-
-
Save ato/241856 to your computer and use it in GitHub Desktop.
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
(defn inside? [[z-re z-im]] | |
(> (+ (* z-re z-re) (* z-im z-im)) 4)) | |
(defn step [c-re c-im [z-re z-im]] | |
[(+ (* 2 z-re z-im) c-im) | |
(+ (- (* z-re z-re) (* z-im z-im)) c-re)]) | |
(doseq [y (range image-height) | |
:let [c-im (- max-im (y * im-factor))] | |
x (range image-width)] | |
(let [c-re (+ min-re (x * re-factor))] | |
(when (some inside? | |
(take max-iterations | |
(iterate #(step c-re c-im %) [c-re c-im]))) | |
(put-pixel x y)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment