Skip to content

Commit

Permalink
ensure height is passed into cilia calculation instead of a global
Browse files Browse the repository at this point in the history
  • Loading branch information
dgtized committed Nov 27, 2024
1 parent 3bab127 commit 1f8f101
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/shimmers/sketches/cilia_phase.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@
;; How to avoid intersecting cilia?
(defn cilias
[{:keys [samples screen-space cilia-spline line-fx
length-fx cilia-amp rot-fx phase]}]
length-fx cilia-amp height-prop rot-fx phase]}]
(for [x samples]
(let [pt (screen-space (:fn line-fx) x phase)
;; what happens if the lookahead distance for the derivitive is oscillating?
pt' (screen-space (:fn line-fx) (+ x 0.0001) phase)
angle (+ (g/heading (tm/- pt' pt)) (* eq/TAU 0.25) ((:fn rot-fx) x))
len (* height (+ cilia-amp (* cilia-amp ((:fn length-fx) x))))]
len (* height-prop (+ cilia-amp (* cilia-amp ((:fn length-fx) x))))]
(cilia-spline (+ x phase) pt angle len))))

(defn gen-density []
Expand Down Expand Up @@ -229,6 +229,7 @@
:line-fx line-fx
:length-fx length-fx
:cilia-amp cilia-amp
:height-prop height ;; FIXME: combine with cilia-amp
:rot-fx rot-fx
:phase phase})]
[(csvg/path (csvg/segmented-path spline-pts))
Expand Down

0 comments on commit 1f8f101

Please sign in to comment.