
(:require [quil.core :as q] [quil.middleware :as m]))
(def w 500)(def h 500)(def levels 4)(def point-a [w 0])(def point-b [0 h])(def point-c [w h])
(defn triSplit[a b c levels] (if (> levels 0) (do (q/line (first a)(second a) (first b)(second b)) (q/line (first b)(second b) (first c)(second c)) (q/line (first c)(second c) (first a)(second a))
(def d (apply vector ; convert to vector (map (partial * 0.5) ; half the sum ^ (map + a b)))) ;add a and b ^
(q/line (first c)(second c) (first d)(second d)) (triSplit a c d (- levels 1)) (triSplit b c d (- levels 1)) )))
(defn setup [] (q/no-loop) (q/background 255) )
(defn update-state [state] )
(defn draw-state [state] (triSplit point-a point-b point-c levels) (q/save-frame "output/####.png")
)
(q/defsketch trisplit :title "" :size [w h] :setup setup :update update-state :draw draw-state :features [:keep-on-top] :middleware [m/fun-mode])I know this is a rather banal question, but I cannot seem to figure out why this is giving a strange output. I appreciate your time in reading this and thank you in advance!
Best
Sam
--
You received this message because you are subscribed to the Google Groups "clj-processing" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clj-processin...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/clj-processing/fab8c657-850a-4078-8f8a-9a1f3b9b2b52%40googlegroups.com.