diff --git a/deps.edn b/deps.edn index 8922304..7a97257 100644 --- a/deps.edn +++ b/deps.edn @@ -4,5 +4,8 @@ :exclusions [com.lowagie/itext]} binaryage/oops {:mvn/version "0.7.0"} rollacaster/clj-axidraw {:git/url "https://github.com/rollacaster/clj-axidraw" - :sha "e31824cf8def9dd01d9b3aa5a5f2e5eddf70f900"}} + :sha "e31824cf8def9dd01d9b3aa5a5f2e5eddf70f900"} + thi.ng/geom {:mvn/version "1.0.0-RC4"} + thi.ng/math {:mvn/version "0.3.0"} + thi.ng/color {:mvn/version "1.4.0"}} :paths ["src" "target" "resources"]} diff --git a/src/sketches/plotting/eye_of_sine.clj b/src/sketches/plotting/eye_of_sine.clj new file mode 100644 index 0000000..9ad3cbc --- /dev/null +++ b/src/sketches/plotting/eye_of_sine.clj @@ -0,0 +1,37 @@ +(ns sketches.plotting.eye-of-sine + (:require [thi.ng.geom.svg.adapter :as adapt] + [thi.ng.geom.svg.core :as svg :refer [ellipse]])) +(def scene + (svg/svg + {:width 300 :height 300} + (svg/group + {} + (let [rings 50] + (map + (fn [i] + (let [progress-in-percent (/ i rings) + cur-pi (* progress-in-percent Math/PI) + min-width 0 + max-additional-width 80] + (ellipse [150 (+ 20 (* 5 i))] (+ min-width (* max-additional-width (Math/sin cur-pi))) 10 + {:fill "none" :stroke "black"}))) + (range rings)))) + (svg/group + {:transform "rotate(90) translate(0 -300)"} + (let [rings 50] + (map + (fn [i] + (let [progress-in-percent (/ i rings) + cur-pi (* progress-in-percent Math/PI) + min-width 0 + max-additional-width 80] + (ellipse [150 (+ 20 (* 5 i))] (+ min-width (* max-additional-width (Math/sin cur-pi))) 10 + {:fill "none" :stroke "black"}))) + (range rings)))))) + +(comment + (->> scene + adapt/all-as-svg + svg/serialize + (spit "temp.svg"))) +