Skip to content

Instantly share code, notes, and snippets.

View JonathanSmith's full-sized avatar

Jonathan A Smith JonathanSmith

View GitHub Profile
(defmap rgb-color-fractal
(let [val %
z (.xy val)
n (.z val)
normalized-count (/ (- n (log2 (log2 (sqrt (+ (* (.x z) (.x z)) (* (.y z) (.y z)))))))
(float max-iterations))]
(? (< 4.0 (dot z z))
(color3 normalized-count normalized-count (mix 0.2 1.0 normalized-count))
(color3 0.0 0.0 0.0))))
(defmap hsv-color-fractal
(let [val %
z (.xy val)
n (.z val)
normalized-count (/ (- n (log2 (log2 (sqrt (+ (* (.x z) (.x z)) (* (.y z) (.y z)))))))
(float max-iterations))
h (* 360.0 normalized-count)
s 0.8
v 1.0
h_v (floor (/ h 60.0))
user=> (time (nbody/main 100000)) ;;one above
(time (nbody/main 100000))
-0.16907516382852444
-0.16907985939166476
"Elapsed time: 2124.75375 msecs"
nil
user=> (time (main 100000)) ;;; nbody_v2
(time (main 100000))
-0.16907516382852444