From 101195b5565ed6eaf31a9ff5d3961d7da07de075 Mon Sep 17 00:00:00 2001 From: Charles Comstock Date: Thu, 28 Nov 2024 21:28:52 -0600 Subject: [PATCH] remove some more redundant nested calls --- src/shimmers/math/control.cljc | 4 ++-- src/shimmers/model/mechanism.cljc | 2 +- src/shimmers/sketches/display_tree.cljs | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/shimmers/math/control.cljc b/src/shimmers/math/control.cljc index ff29a2d43..ba9182055 100644 --- a/src/shimmers/math/control.cljc +++ b/src/shimmers/math/control.cljc @@ -14,12 +14,12 @@ (defn angular-acceleration [angle target control angle-vel] (let [delta (angular-delta angle target)] (- (* control delta) - (* (* 2 (math/sqrt control)) angle-vel)))) + (* 2 (math/sqrt control) angle-vel)))) (defn spin-acceleration [angle-vel target-vel control] (let [delta (- target-vel angle-vel)] (- (* control delta) - (* (* 2 (math/sqrt control)) angle-vel)))) + (* 2 (math/sqrt control) angle-vel)))) (defn force-accel [pos target control velocity] (let [dir (tm/- target pos)] diff --git a/src/shimmers/model/mechanism.cljc b/src/shimmers/model/mechanism.cljc index bd0d121f9..3b5028a36 100644 --- a/src/shimmers/model/mechanism.cljc +++ b/src/shimmers/model/mechanism.cljc @@ -125,7 +125,7 @@ (+ (if (or (= driver-type :ring-gear) (= type :ring-gear)) (+ (* gear-ratio (+ offset (- math/PI angle))) angle) (+ (* gear-ratio offset) - (* (+ gear-ratio 1) (* dir angle))))) + (* (+ gear-ratio 1) dir angle)))) (mod (/ tm/TWO_PI teeth)))) 0)) diff --git a/src/shimmers/sketches/display_tree.cljs b/src/shimmers/sketches/display_tree.cljs index af9cbc017..c2ba98e59 100644 --- a/src/shimmers/sketches/display_tree.cljs +++ b/src/shimmers/sketches/display_tree.cljs @@ -222,7 +222,7 @@ (defn make-triangle [bounds] (let [limit (min (g/width bounds) (g/height bounds)) s (if (dr/chance 0.75) (dr/random 0.15 0.66) 0) - radius (* s (* 0.65 limit)) + radius (* s 0.65 limit) n-triangles (dr/weighted {1 1 3 2 5 3 7 2}) angle (* eq/TAU (dr/rand-nth (butlast (tm/norm-range 4)))) spin (* (dr/random-sign) @@ -397,10 +397,10 @@ (fn [t _f] (mod (+ (* dir t) v) 1.0))) :radial (let [factor (math/pow 2.0 (dr/rand-nth [0 0 6]))] - (fn [t _f] (eq/unit-sin (+ (/ r factor) (* 1.5 (* dir t)))))) + (fn [t _f] (eq/unit-sin (+ (/ r factor) (* 1.5 dir t))))) :sweep (let [blades (dr/random-int 4)] - (fn [t _f] (eq/unit-sin (+ (+ blades theta) (* dir t))))))))] + (fn [t _f] (eq/unit-sin (+ blades theta (* dir t))))))))] (fn [p rotation t f] (doseq [{:keys [value] :as div} divisions] (q/fill (value t f))