Skip to content

Instantly share code, notes, and snippets.

@ztellman
Created October 8, 2009 05:55
Show Gist options
  • Save ztellman/204790 to your computer and use it in GitHub Desktop.
Save ztellman/204790 to your computer and use it in GitHub Desktop.
(defmap iterate-fractal
(let [val %
z (.xy val)
c (mix upper-left lower-right (/ :coord :dim))
iterations (.z val)]
(? (< 4.0 (dot z z))
val
(float3
(+ c
(float2
(- (* (.x z) (.x z)) (* (.y z) (.y z)))
(* 2.0 (.x z) (.y z))))
(+ 1.0 iterations)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment