|
19 | 19 | (defn rv [x y] |
20 | 20 | (gv/vec2 (* width x) (* height y))) |
21 | 21 |
|
22 | | -(defn maurer-rose [{:keys [samples rotation n d]}] |
| 22 | +(defn maurer-rose [{:keys [samples rotation n d pm m]}] |
23 | 23 | (let [center (rv 0.5 0.5) |
24 | 24 | radius (* 0.49 height) |
25 | 25 | rot (tm/radians rotation)] |
26 | 26 | (->> (for [i (range (inc samples)) |
27 | 27 | :let [k (tm/radians (* d i))]] |
28 | 28 | (v/+polar center |
29 | | - (* radius (math/sin (+ rot (* n k)))) |
| 29 | + (* radius (math/sin (+ rot (* n k) |
| 30 | + (* pm (math/sin (tm/radians (* m i))))))) |
30 | 31 | (+ k rot))) |
31 | 32 | csvg/segmented-path |
32 | 33 | csvg/path))) |
|
73 | 74 | {:n ((if (dr/chance 0.5) math/round identity) |
74 | 75 | (dr/random 2 16)) |
75 | 76 | :d ((if (dr/chance 0.3) math/round identity) |
76 | | - (dr/random 2 128))} |
| 77 | + (dr/random 2 128)) |
| 78 | + :pm (if (dr/chance 0.75) 0.0 1.0) |
| 79 | + :m (if (dr/chance 0.66) 0.0 |
| 80 | + (/ (float (dr/random-int 0 64)) |
| 81 | + (float (dr/weighted {1.0 6 2.0 2 3.0 1 4.0 1}))))} |
77 | 82 | :chorded |
78 | 83 | {:n ((if (dr/chance 0.4) math/round identity) |
79 | 84 | (min (dr/random 0.5 9) |
|
101 | 106 | [ctrl/numeric params "Samples" [:samples] [1 5000 1]] |
102 | 107 | [ctrl/numeric params "N" [:n] [0.01 360 0.00001]] |
103 | 108 | (when (not= method :modulo-chords) |
104 | | - [ctrl/numeric params "D" [:d] [0.01 128 0.00001]])]])) |
| 109 | + [ctrl/numeric params "D" [:d] [0.01 128 0.00001]]) |
| 110 | + (when (= method :maurer-rose) |
| 111 | + [ctrl/numeric params "Phase M" [:pm] [0.00 16.0 0.001]]) |
| 112 | + (when (= method :maurer-rose) |
| 113 | + [ctrl/numeric params "M" [:m] [0.01 64 0.0001]])]])) |
105 | 114 |
|
106 | 115 | (sketch/definition principles-of-chording |
107 | 116 | {:created-at "2026-04-14" |
|
0 commit comments