Skip to content

Commit

Permalink
Prefer cljs.core/abs for abs usage
Browse files Browse the repository at this point in the history
  • Loading branch information
dgtized committed Aug 4, 2023
1 parent 54ec732 commit 8879bc2
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/shimmers/math/deterministic_random.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
"Generate an ordered range of values from [0..1] with normal spacing `mu`, and
standard-deviation `sd`."
([mu sd]
(->> #(tm/abs* (gaussian mu sd))
(->> #(abs (gaussian mu sd))
repeatedly
(reductions +)
(take-while #(< % 1.0))
Expand Down
2 changes: 1 addition & 1 deletion src/shimmers/sketches/ballistics.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@

(defn fire-projectile [state {:keys [pos angle target]}]
(let [dir (v/polar 1.0 angle)
[x y] (tm/abs (tm/- (:pos target) pos))
[x y] (abs (tm/- (:pos target) pos))
;; v0 is ignoring drag
v0 (initial-velocity angle [x y])
v0' (* v0 (dr/gaussian 1.0 0.12))
Expand Down
2 changes: 1 addition & 1 deletion src/shimmers/sketches/motif_shapes.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

(defn group-mirror [group direction]
(let [bounds (g/bounds group)
offset (tm/abs (rect/bottom-left bounds))
offset (abs (rect/bottom-left bounds))
;; ensure entire group is inside of upper-right quadrant before mirroring
g (g/translate group (tm/* offset 1.1))
dir (case direction
Expand Down
7 changes: 4 additions & 3 deletions src/shimmers/sketches/superposition_mirrored.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@
If distance is less than `percent-cutoff` output is 0.0"
[percent-cutoff n]
(tm/map-interval-clamped (abs (- n 0.5))
[(* percent-cutoff 0.5) 0.5]
[0.0 1.0]))
(tm/map-interval-clamped
(abs (- n 0.5))
(* percent-cutoff 0.5) 0.5
0.0 1.0))

(defrecord Particle [pos angle vel angle-vel dest])

Expand Down
2 changes: 1 addition & 1 deletion src/shimmers/sketches/velocity_fields.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
[true false] 2
[false true] 4
[true true] 8})]
{:seed (tm/abs (dr/randvec2 100))
{:seed (abs (dr/randvec2 100))
:scaling scaling
:scale (/ 1.0 scaling)
:offset (dr/weighted {0 2 4 2 8 2 12 1})
Expand Down

0 comments on commit 8879bc2

Please sign in to comment.