This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-01-06
Channels
- # aleph (13)
- # announcements (1)
- # babashka (89)
- # beginners (23)
- # calva (14)
- # circleci (7)
- # clj-kondo (39)
- # clj-on-windows (1)
- # cljdoc (5)
- # cljsrn (29)
- # clojure (98)
- # clojure-art (3)
- # clojure-conj (5)
- # clojure-europe (14)
- # clojure-nl (1)
- # clojure-norway (9)
- # clojurescript (18)
- # clr (39)
- # code-art (3)
- # community-development (3)
- # cursive (3)
- # emacs (11)
- # events (1)
- # fulcro (12)
- # graalvm-mobile (16)
- # graphql (3)
- # gratitude (1)
- # honeysql (19)
- # java (7)
- # joyride (23)
- # lsp (22)
- # malli (2)
- # missionary (25)
- # off-topic (15)
- # polylith (15)
- # rdf (5)
- # reagent (9)
- # reitit (3)
- # scittle (3)
- # shadow-cljs (37)
- # slack-help (2)
- # sql (10)
I put this in #C0VSY2FQ8, maybe this is the better place: I made this guy last week, based on Geilis's superformula + SVG path interpolation. It may run slowly on older computers https://moea.github.io/cromulator/ — it randomly cycles through the output space as constrained by the parameters, by tweening as dramatically as it can back and forth between two paths before transitioning to a third
🆒 4
🤯 2
It basically comes down to
(ns cromulator.geom
(:require [cromulator.util
:refer [pointwise both TAU cos sin pow]]))
(defn- sf-point [m1 m2 n1 n2 n3 a b phi]
(let [xf (fn [f m exp] (-> m (* phi) (/ 4) f (/ a) abs (pow exp)))
r (pow (+ (xf cos m1 n2) (xf sin (or m2 m1) n3)) (/ 1 n1))]
(if (zero? r)
[0 0]
(both * (/ 1 r) (cos phi) (sin phi)))))
(defn superformula-points [coords {m1 :m1 m2 :m2 n1 :n1 n2 :n2 n3 :n3 a :a b :b}
& [{res :resolution :or {res 1024}}]]
(into []
(comp
(map (partial * (/ TAU res)))
(map (partial sf-point m1 m2 n1 n2 n3 a b))
(map (partial pointwise + coords)))
(range (inc res))))