From 554465ef1a3c7544f5722b4e43d37fdead728198 Mon Sep 17 00:00:00 2001 From: Charles Comstock Date: Tue, 26 Nov 2024 23:01:18 -0600 Subject: [PATCH] add a positive check version if v/contains-NaN? --- src/shimmers/math/vector.cljc | 4 ++++ src/shimmers/sketches/cilia_phase.cljs | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/shimmers/math/vector.cljc b/src/shimmers/math/vector.cljc index f034fb11..241b80b8 100644 --- a/src/shimmers/math/vector.cljc +++ b/src/shimmers/math/vector.cljc @@ -69,3 +69,7 @@ #?(:cljs (defn contains-NaN? [v] (some js/isNaN v))) + +#?(:cljs + (defn valid? [v] + (not-any? js/isNaN v))) diff --git a/src/shimmers/sketches/cilia_phase.cljs b/src/shimmers/sketches/cilia_phase.cljs index 29e64e97..da60e4dd 100644 --- a/src/shimmers/sketches/cilia_phase.cljs +++ b/src/shimmers/sketches/cilia_phase.cljs @@ -72,7 +72,7 @@ (let [fy (spline cx x)] (tm/+ (tm/mix a b x) (tm/mix (tm/- axis) axis fy))))] - (when (not-any? v/contains-NaN? pts) + (when (every? v/valid? pts) (csvg/path (csvg/segmented-path pts))))) ;; How to avoid intersecting cilia?