@logomarks/generate 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/LICENSE +21 -0
  3. package/README.md +41 -2
  4. package/package.json +29 -4
  5. package/src/controls.js +34 -0
  6. package/src/draw.js +60 -0
  7. package/src/finish.js +172 -0
  8. package/src/generate.js +194 -0
  9. package/src/guard.js +66 -0
  10. package/src/index.d.ts +96 -0
  11. package/src/index.js +9 -0
  12. package/src/presets.js +26 -0
  13. package/src/random.js +23 -0
  14. package/src/raster.js +52 -0
  15. package/src/recipes/arcs.js +83 -0
  16. package/src/recipes/bands.js +90 -0
  17. package/src/recipes/bars.js +106 -0
  18. package/src/recipes/blobs.js +74 -0
  19. package/src/recipes/bloom.js +53 -0
  20. package/src/recipes/burst.js +44 -0
  21. package/src/recipes/chevrons.js +45 -0
  22. package/src/recipes/cut.js +80 -0
  23. package/src/recipes/dashes.js +61 -0
  24. package/src/recipes/dots.js +47 -0
  25. package/src/recipes/fan.js +73 -0
  26. package/src/recipes/fold.js +66 -0
  27. package/src/recipes/hex.js +58 -0
  28. package/src/recipes/horizon.js +51 -0
  29. package/src/recipes/index.js +79 -0
  30. package/src/recipes/iso.js +35 -0
  31. package/src/recipes/letter.js +204 -0
  32. package/src/recipes/line.js +142 -0
  33. package/src/recipes/links.js +63 -0
  34. package/src/recipes/orbit.js +50 -0
  35. package/src/recipes/pixel.js +38 -0
  36. package/src/recipes/rings.js +82 -0
  37. package/src/recipes/route.js +107 -0
  38. package/src/recipes/shear.js +61 -0
  39. package/src/recipes/spiral.js +42 -0
  40. package/src/recipes/split.js +54 -0
  41. package/src/recipes/stack.js +71 -0
  42. package/src/recipes/steps.js +35 -0
  43. package/src/recipes/stripes.js +66 -0
  44. package/src/recipes/tiles.js +60 -0
  45. package/src/recipes/tri.js +126 -0
  46. package/src/recipes/turns.js +41 -0
  47. package/src/recipes/twin.js +64 -0
  48. package/src/recipes/venn.js +54 -0
  49. package/src/recipes/waves.js +40 -0
  50. package/src/shapes.js +54 -0
@@ -0,0 +1,79 @@
1
+ /**
2
+ * The recipes, by id, in the order a picker lists them. Every recipe also takes the shared finish controls (FINISH).
3
+ */
4
+ import * as bars from './bars.js';
5
+ import * as bands from './bands.js';
6
+ import * as twin from './twin.js';
7
+ import * as stack from './stack.js';
8
+ import * as shear from './shear.js';
9
+ import * as turns from './turns.js';
10
+ import * as burst from './burst.js';
11
+ import * as tiles from './tiles.js';
12
+ import * as route from './route.js';
13
+ import * as arcs from './arcs.js';
14
+ import * as rings from './rings.js';
15
+ import * as stripes from './stripes.js';
16
+ import * as dots from './dots.js';
17
+ import * as pixel from './pixel.js';
18
+ import * as chevrons from './chevrons.js';
19
+ import * as waves from './waves.js';
20
+ import * as cut from './cut.js';
21
+ import * as split from './split.js';
22
+ import * as venn from './venn.js';
23
+ import * as blobs from './blobs.js';
24
+ import * as dashes from './dashes.js';
25
+ import * as fan from './fan.js';
26
+ import * as fold from './fold.js';
27
+ import * as spiral from './spiral.js';
28
+ import * as orbit from './orbit.js';
29
+ import * as bloom from './bloom.js';
30
+ import * as links from './links.js';
31
+ import * as horizon from './horizon.js';
32
+ import * as steps from './steps.js';
33
+ import * as hex from './hex.js';
34
+ import * as tri from './tri.js';
35
+ import * as iso from './iso.js';
36
+ import * as line from './line.js';
37
+ import * as letter from './letter.js';
38
+ import { FINISH, finish } from '../finish.js';
39
+
40
+ /** A recipe with the finish controls appended and applied. */
41
+ const R = (id, name, line, m) => ({ id, name, line, controls: [...m.controls, ...FINISH], build: (p) => finish(m.build(p), p), guard: m.guard || {} });
42
+
43
+ /** Every recipe: its id, name, one line and controls, and its `build(params)`. */
44
+ export const RECIPES = {
45
+ bars: R('bars', 'Bars', 'Upright bars with one cut, step or slant.', bars),
46
+ bands: R('bands', 'Bands', 'Stacked bands that climb through one bend.', bands),
47
+ twin: R('twin', 'Twin', 'One piece and its twin, turned halfway round.', twin),
48
+ stack: R('stack', 'Stack', 'Two to four simple shapes stacked, overlapped or nested.', stack),
49
+ shear: R('shear', 'Shear', 'A grid of slanted tiles, some left out.', shear),
50
+ turns: R('turns', 'Turns', 'One shape turned round a centre three to eight times.', turns),
51
+ burst: R('burst', 'Burst', 'Rays round a centre, with one move.', burst),
52
+ tiles: R('tiles', 'Tiles', 'A grid of squares, quarter rounds and discs.', tiles),
53
+ route: R('route', 'Route', 'Heavy bands at 0, 45 and 90° that fork and turn.', route),
54
+ arcs: R('arcs', 'Arcs', 'Nested quarter or half rings from a corner.', arcs),
55
+ rings: R('rings', 'Rings', 'Concentric rings broken by turning gaps.', rings),
56
+ stripes: R('stripes', 'Stripes', 'A shape drawn in stripes, with one move.', stripes),
57
+ dots: R('dots', 'Dots', 'A halftone grid: dot sizes make the shape.', dots),
58
+ pixel: R('pixel', 'Pixel', 'A mirrored pixel figure from a layout number.', pixel),
59
+ chevrons: R('chevrons', 'Chevrons', 'Chevrons stacked along their point.', chevrons),
60
+ waves: R('waves', 'Waves', 'Wavy bands, in step or turning.', waves),
61
+ cut: R('cut', 'Cut', 'One solid with one cut: a bite, notch, slot or step.', cut),
62
+ split: R('split', 'Split', 'A shape cut into slid parts by straight lines.', split),
63
+ venn: R('venn', 'Venn', 'Overlapping circles or squares, xor, over or knocked out.', venn),
64
+ blobs: R('blobs', 'Blobs', 'Discs fused by soft necks.', blobs),
65
+ dashes: R('dashes', 'Dashes', 'Rows of dashes with a rhythm.', dashes),
66
+ fan: R('fan', 'Fan', 'Blades fanned out from a pivot.', fan),
67
+ fold: R('fold', 'Fold', 'One heavy band folded back and forth.', fold),
68
+ spiral: R('spiral', 'Spiral', 'One round band coiled, with a dot or a tail.', spiral),
69
+ orbit: R('orbit', 'Orbit', 'A planet with tilted rings passing in front and behind.', orbit),
70
+ bloom: R('bloom', 'Bloom', 'Petals round an open or dotted centre.', bloom),
71
+ links: R('links', 'Links', 'Two or three loops woven like a chain.', links),
72
+ horizon: R('horizon', 'Horizon', 'A striped sun over horizon lines.', horizon),
73
+ steps: R('steps', 'Steps', 'A staircase or ziggurat of blocks.', steps),
74
+ hex: R('hex', 'Hex', 'A honeycomb cluster of hexagon cells.', hex),
75
+ tri: R('tri', 'Tri', 'A grid of triangles in a triangle or hexagon.', tri),
76
+ iso: R('iso', 'Iso', 'Isometric cubes stacked from a height map.', iso),
77
+ line: R('line', 'Line', 'One heavy stroke through a few points, with a loop or a fold.', line),
78
+ letter: R('letter', 'Letter', 'One capital or numeral in blocks, tiles, pixels, stencil, slabs or route.', letter),
79
+ };
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Iso: isometric cubes stacked on a small height map (two to four cells a side, heights up to three) chosen by a
3
+ * numbered layout and made symmetric if asked, every face parted from its neighbours by the house gap. After iso
4
+ * cube and stacked-block marks.
5
+ */
6
+ import { cubes } from '@logomarks/core/geometry';
7
+ import { BOX, tidy } from '../draw.js';
8
+ import { rng } from '../random.js';
9
+
10
+ /** @type {import('../index.js').Control[]} */
11
+ export const controls = [
12
+ { key: 'grid', label: 'Grid', type: 'range', min: 2, max: 4, step: 1, value: 3 },
13
+ { key: 'layout', label: 'Layout no.', type: 'range', min: 1, max: 999, step: 1, value: 9 },
14
+ { key: 'height', label: 'Tallest', type: 'range', min: 1, max: 3, step: 1, value: 2 },
15
+ { key: 'density', label: 'Density', type: 'range', min: 0.3, max: 1, step: 0.01, value: 0.7 },
16
+ { key: 'symmetry', label: 'Symmetry', type: 'choice', options: ['mirror', 'none', 'stairs'], value: 'mirror' },
17
+ ];
18
+
19
+ /** The mark for resolved params. */
20
+ export function build(p) {
21
+ const n = p.grid, rand = rng(`iso:${p.layout}:${n}`), H = [];
22
+ for (let i = 0; i < n; i++) { H.push([]); for (let j = 0; j < n; j++) H[i].push(rand() < p.density ? 1 + Math.floor(rand() * p.height) : 0); }
23
+ if (p.symmetry === 'mirror') for (let i = 0; i < n; i++) for (let j = 0; j < n; j++) if (j > i) H[i][j] = H[j][i];
24
+ if (p.symmetry === 'stairs') for (let i = 0; i < n; i++) for (let j = 0; j < n; j++) H[i][j] = Math.max(0, Math.min(p.height, Math.round(((n - 1 - i + n - 1 - j) / (2 * (n - 1))) * p.height + 0.4)));
25
+ const list = [];
26
+ for (let i = 0; i < n; i++) for (let j = 0; j < n; j++) for (let z = 0; z < H[i][j]; z++) list.push([i - (n - 1) / 2, j - (n - 1) / 2, z]);
27
+ if (!list.length) return [];
28
+ // the cube edge: the stack fills the box (its iso width is about 2 × 0.866 × n cubes)
29
+ const u = BOX.size / (Math.sqrt(3) * n + 0.4);
30
+ // faces hidden down to slivers behind a nearer cube are dropped
31
+ return tidy(cubes(list, u, 0, -((p.height - 1) * u) / 2.4), { share: 0.002, width: 12 });
32
+ }
33
+
34
+ /** Many cubes, three faces each. */
35
+ export const guard = { maxPieces: 120, minPieceShare: 0.002, minMeanWidth: 10, minInkShare: 0.1, maxThinShare: 0.12 }; // faces meet at 60°
@@ -0,0 +1,204 @@
1
+ /**
2
+ * Letter: one capital A–Z or numeral 0–9 in one of six constructions. Three from a 5 × 7 bitmap: blocks (the cells
3
+ * merged, square), tiles (the cells as squares and quarter discs, the outer corners rounded) and pixel (the cells parted
4
+ * by the gap). Three from core's letter skeletons (one geometric sans as centrelines): stencil (each stroke solid, split
5
+ * at its sharp corners and cleared from the ones before by the gap, a closed bowl slit at its top), slabs (the stencil
6
+ * parts sheared and parted wider, like Shear) and route (the skeleton walked in runs at 0°, 45° and 90°, mitred, like
7
+ * Route). After lettermarks built as blocks, slabs and bands: a K of slanted slabs, an H of three bars.
8
+ */
9
+ import { U, D, I, rect, rr, mapPts, stroke, SKEL, skelSolid, skStroke, skLine, robust } from '@logomarks/core/geometry';
10
+ import { BOX, GAP, clear, tidy } from '../draw.js';
11
+
12
+ robust();
13
+
14
+ /** The 5 × 7 bitmaps, rows top to bottom. */
15
+ const BITMAP = {
16
+ A: ['.###.', '#...#', '#...#', '#####', '#...#', '#...#', '#...#'],
17
+ B: ['####.', '#...#', '#...#', '####.', '#...#', '#...#', '####.'],
18
+ C: ['.####', '#....', '#....', '#....', '#....', '#....', '.####'],
19
+ D: ['####.', '#...#', '#...#', '#...#', '#...#', '#...#', '####.'],
20
+ E: ['#####', '#....', '#....', '####.', '#....', '#....', '#####'],
21
+ F: ['#####', '#....', '#....', '####.', '#....', '#....', '#....'],
22
+ G: ['.####', '#....', '#....', '#.###', '#...#', '#...#', '.####'],
23
+ H: ['#...#', '#...#', '#...#', '#####', '#...#', '#...#', '#...#'],
24
+ I: ['#####', '..#..', '..#..', '..#..', '..#..', '..#..', '#####'],
25
+ J: ['....#', '....#', '....#', '....#', '#...#', '#...#', '.###.'],
26
+ K: ['#...#', '#..#.', '#.#..', '##...', '#.#..', '#..#.', '#...#'],
27
+ L: ['#....', '#....', '#....', '#....', '#....', '#....', '#####'],
28
+ M: ['#...#', '##.##', '#.#.#', '#.#.#', '#...#', '#...#', '#...#'],
29
+ N: ['#...#', '##..#', '#.#.#', '#..##', '#...#', '#...#', '#...#'],
30
+ O: ['.###.', '#...#', '#...#', '#...#', '#...#', '#...#', '.###.'],
31
+ P: ['####.', '#...#', '#...#', '####.', '#....', '#....', '#....'],
32
+ Q: ['.###.', '#...#', '#...#', '#...#', '#.#.#', '#..#.', '.##.#'],
33
+ R: ['####.', '#...#', '#...#', '####.', '#.#..', '#..#.', '#...#'],
34
+ S: ['.####', '#....', '#....', '.###.', '....#', '....#', '####.'],
35
+ T: ['#####', '..#..', '..#..', '..#..', '..#..', '..#..', '..#..'],
36
+ U: ['#...#', '#...#', '#...#', '#...#', '#...#', '#...#', '.###.'],
37
+ V: ['#...#', '#...#', '#...#', '#...#', '#...#', '.#.#.', '..#..'],
38
+ W: ['#...#', '#...#', '#...#', '#.#.#', '#.#.#', '##.##', '#...#'],
39
+ X: ['#...#', '#...#', '.#.#.', '..#..', '.#.#.', '#...#', '#...#'],
40
+ Y: ['#...#', '#...#', '.#.#.', '..#..', '..#..', '..#..', '..#..'],
41
+ Z: ['#####', '....#', '...#.', '..#..', '.#...', '#....', '#####'],
42
+ 0: ['.###.', '#...#', '#..##', '#.#.#', '##..#', '#...#', '.###.'],
43
+ 1: ['..#..', '.##..', '..#..', '..#..', '..#..', '..#..', '.###.'],
44
+ 2: ['.###.', '#...#', '....#', '..##.', '.#...', '#....', '#####'],
45
+ 3: ['####.', '....#', '....#', '.###.', '....#', '....#', '####.'],
46
+ 4: ['...#.', '..##.', '.#.#.', '#..#.', '#####', '...#.', '...#.'],
47
+ 5: ['#####', '#....', '####.', '....#', '....#', '#...#', '.###.'],
48
+ 6: ['.###.', '#....', '#....', '####.', '#...#', '#...#', '.###.'],
49
+ 7: ['#####', '....#', '...#.', '..#..', '.#...', '.#...', '.#...'],
50
+ 8: ['.###.', '#...#', '#...#', '.###.', '#...#', '#...#', '.###.'],
51
+ 9: ['.###.', '#...#', '#...#', '.####', '....#', '....#', '.###.'],
52
+ };
53
+
54
+ const CHARS = [...'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'];
55
+ const NUMERAL = { 0: 'Zero', 1: 'One', 2: 'Two', 3: 'Three', 4: 'Four', 5: 'Five', 6: 'Six', 7: 'Seven', 8: 'Eight', 9: 'Nine' };
56
+
57
+ /** @type {import('../index.js').Control[]} */
58
+ export const controls = [
59
+ { key: 'char', label: 'Letter', type: 'choice', options: CHARS, value: 'K' },
60
+ { key: 'build', label: 'Build', type: 'choice', options: ['slabs', 'stencil', 'route', 'tiles', 'blocks', 'pixel'], value: 'slabs' },
61
+ { key: 'weight', label: 'Weight', type: 'range', min: 0.12, max: 0.26, step: 0.005, value: 0.2 },
62
+ { key: 'slant', label: 'Slant', type: 'range', min: -20, max: 20, step: 1, value: 0 },
63
+ { key: 'spacing', label: 'Gaps', type: 'range', min: 1, max: 2.5, step: 0.1, value: 1.2 },
64
+ { key: 'soft', label: 'Round corners (tiles)', type: 'range', min: 0, max: 1, step: 0.05, value: 1 },
65
+ ];
66
+
67
+ /* ---------- the bitmap builds ---------- */
68
+
69
+ /** The bitmap's cells, as [col, row] for every filled one. */
70
+ function cells(ch) {
71
+ const rows = BITMAP[ch], out = [];
72
+ rows.forEach((row, r) => [...row].forEach((c, k) => { if (c === '#') out.push([k, r]); }));
73
+ return out;
74
+ }
75
+
76
+ /** A bitmap letter: blocks merged, tiles rounded at their outer corners, or pixels parted by the gap. */
77
+ function bitmapLetter(ch, build, p) {
78
+ const on = new Set(cells(ch).map(([c, r]) => `${c},${r}`)), has = (c, r) => on.has(`${c},${r}`);
79
+ const g = build === 'pixel' ? GAP * p.spacing : 0, cell = (BOX.size - 6 * g) / 7;
80
+ const parts = [];
81
+ for (const [c, r] of cells(ch)) {
82
+ const x = BOX.cx - (5 * cell + 4 * g) / 2 + c * (cell + g), y = BOX.y0 + r * (cell + g);
83
+ if (build === 'tiles') {
84
+ // a corner rounds where nothing touches it: both side neighbours and the diagonal one are empty
85
+ const free = (dc, dr) => !has(c + dc, r) && !has(c, r + dr) && !has(c + dc, r + dr);
86
+ const k = cell * p.soft;
87
+ parts.push(rr(x, y, cell, cell, [free(-1, -1) ? k : 0, free(1, -1) ? k : 0, free(1, 1) ? k : 0, free(-1, 1) ? k : 0]));
88
+ } else parts.push(rect(x - (g ? 0 : 0.01), y - (g ? 0 : 0.01), cell + (g ? 0 : 0.02), cell + (g ? 0 : 0.02)));
89
+ }
90
+ return U(...parts);
91
+ }
92
+
93
+ /* ---------- the skeleton builds ---------- */
94
+
95
+ /** The letter's skeleton at cap height H: core's, with an I (bars top and foot) core doesn't have. */
96
+ function skeleton(ch, H) {
97
+ if (ch === 'I') { const w = H * 0.72; return [skStroke(skLine([0, 0], [w, 0])), skStroke(skLine([w / 2, 0], [w / 2, H]), ['j', 'j']), skStroke(skLine([0, H], [w, H]))]; }
98
+ return SKEL[NUMERAL[ch] || ch](H);
99
+ }
100
+
101
+ /** The turn at point b, in degrees. */
102
+ function turnAt(a, b, c) {
103
+ const u = [b[0] - a[0], b[1] - a[1]], v = [c[0] - b[0], c[1] - b[1]], lu = Math.hypot(...u), lv = Math.hypot(...v);
104
+ if (!lu || !lv) return 0;
105
+ return (Math.acos(Math.max(-1, Math.min(1, (u[0] * v[0] + u[1] * v[1]) / (lu * lv)))) * 180) / Math.PI;
106
+ }
107
+
108
+ /** Strokes split at their sharp corners (a turn over 50°), so a stencil gap can open there. */
109
+ function splitAtCorners(strokes) {
110
+ const out = [];
111
+ for (const s of strokes) {
112
+ const p = s.p, cuts = [];
113
+ for (let i = 1; i < p.length - 1; i++) if (turnAt(p[i - 1], p[i], p[i + 1]) > 50) cuts.push(i);
114
+ if (!cuts.length) { out.push(s); continue; }
115
+ let from = 0;
116
+ for (const [k, i] of [...cuts, p.length - 1].entries()) {
117
+ const e = [from === 0 ? s.e[0] : 'f', i === p.length - 1 ? s.e[1] : 'f'];
118
+ if (i - from >= 1) out.push(skStroke(p.slice(from, i + 1), e));
119
+ from = i;
120
+ void k;
121
+ }
122
+ if (s.closed) out.push(skStroke([p.at(-1), p[0]], ['f', 'f']));
123
+ }
124
+ return out;
125
+ }
126
+
127
+ /** The length of a stroke's centreline. */
128
+ const lengthOf = (s) => s.p.reduce((t, q, i) => (i ? t + Math.hypot(q[0] - s.p[i - 1][0], q[1] - s.p[i - 1][1]) : 0), 0);
129
+
130
+ /** A stencil letter: each stroke solid, the longest first, every later one cleared from those before by the gap. */
131
+ function stencilLetter(ch, H, T, gap) {
132
+ const strokes = splitAtCorners(skeleton(ch, H)).sort((a, b) => lengthOf(b) - lengthOf(a));
133
+ const parts = [];
134
+ for (const s of strokes) {
135
+ let solid = skelSolid(null, H, T, [s]);
136
+ // a closed bowl with no corners (an O, a 0, the loops of an 8) is slit at its top, or it would hold no gap at all
137
+ if (s.closed) { const top = Math.min(...s.p.map(([, y]) => y)), xs = s.p.filter(([, y]) => y < top + 2).map(([x]) => x), cx = xs.reduce((a, b) => a + b, 0) / xs.length; solid = D(solid, rect(cx - gap / 2, top - T, gap, T * 2)); }
138
+ parts.push(parts.length ? clear(solid, U(...parts), gap) : solid);
139
+ }
140
+ return U(...parts);
141
+ }
142
+
143
+ /**
144
+ * A route letter: the skeleton walked in runs at 0°, 45° and 90°, stroked with mitred joins and clipped at the cap and
145
+ * base lines. A long straight stroke at another angle becomes a dog-leg (its straight part, then its 45° part), as Route
146
+ * draws; a curve (a run of short segments) is resampled and each step snapped to the nearest of the eight directions.
147
+ */
148
+ function routeLetter(ch, H, T) {
149
+ const step = H / 7, long = H / 5, parts = [];
150
+ const snap = (cur, q) => { const dx = q[0] - cur[0], dy = q[1] - cur[1], a = Math.round(Math.atan2(dy, dx) / (Math.PI / 4)) * (Math.PI / 4), len = dx * Math.cos(a) + dy * Math.sin(a); return len > 1 ? [cur[0] + Math.cos(a) * len, cur[1] + Math.sin(a) * len] : null; };
151
+ for (const s of skeleton(ch, H)) {
152
+ const p = s.closed ? [...s.p, s.p[0]] : s.p;
153
+ // merge collinear points into segments
154
+ const segs = [[p[0], p[1]]];
155
+ for (let i = 2; i < p.length; i++) { const last = segs.at(-1); if (turnAt(last[0], last[1], p[i]) < 3) last[1] = p[i]; else segs.push([last[1], p[i]]); }
156
+ const walk = [p[0]];
157
+ let curve = [];
158
+ const flush = () => {
159
+ // a curve: resample every `step` along it, then walk it in snapped runs
160
+ if (!curve.length) return;
161
+ const pts = [walk.at(-1), ...curve];
162
+ let carry = 0;
163
+ for (let i = 1; i < pts.length; i++) {
164
+ const [ax, ay] = pts[i - 1], [bx, by] = pts[i], L = Math.hypot(bx - ax, by - ay);
165
+ let t = step - carry;
166
+ while (t <= L) { const q = snap(walk.at(-1), [ax + ((bx - ax) * t) / L, ay + ((by - ay) * t) / L]); if (q) walk.push(q); t += step; }
167
+ carry = L - (t - step);
168
+ }
169
+ const q = snap(walk.at(-1), pts.at(-1)); if (q) walk.push(q);
170
+ curve = [];
171
+ };
172
+ for (const [a, b] of segs) {
173
+ const L = Math.hypot(b[0] - a[0], b[1] - a[1]);
174
+ if (L < long) { curve.push(b); continue; }
175
+ flush();
176
+ const cur = walk.at(-1), dx = b[0] - cur[0], dy = b[1] - cur[1], ang = (Math.atan2(dy, dx) * 180) / Math.PI;
177
+ const off = Math.abs(((ang % 45) + 45) % 45);
178
+ if (off < 8 || off > 37) { const q = snap(cur, b); if (q) walk.push(q); continue; }
179
+ // a dog-leg: the straight part along the stroke's main axis, then the 45° part into its end
180
+ const ax = Math.abs(dx), ay = Math.abs(dy), d = Math.min(ax, ay);
181
+ const mid = ax > ay ? [cur[0] + Math.sign(dx) * (ax - d), cur[1]] : [cur[0], cur[1] + Math.sign(dy) * (ay - d)];
182
+ walk.push(mid, [mid[0] + Math.sign(dx) * d, mid[1] + Math.sign(dy) * d]);
183
+ }
184
+ flush();
185
+ const pts = walk.filter((q, i) => i === 0 || i === walk.length - 1 || turnAt(walk[i - 1], q, walk[i + 1]) > 1);
186
+ if (pts.length >= 2) parts.push(stroke(pts, T, {}));
187
+ }
188
+ return I(U(...parts), rect(-600, -T / 2, 1800, H + T));
189
+ }
190
+
191
+ /** The mark for resolved params. */
192
+ export function build(p) {
193
+ const ch = String(p.char), H = 400, T = p.weight * BOX.size;
194
+ let s;
195
+ if (p.build === 'tiles' || p.build === 'blocks' || p.build === 'pixel') s = bitmapLetter(ch, p.build, p);
196
+ else if (p.build === 'route') s = routeLetter(ch, H, T * 0.9);
197
+ else s = stencilLetter(ch, H, T, GAP * p.spacing * (p.build === 'slabs' ? 1.5 : 1));
198
+ const slant = p.slant + (p.build === 'slabs' ? 12 : 0);
199
+ if (slant) { const k = Math.tan((slant * Math.PI) / 180), my = p.build === 'tiles' || p.build === 'blocks' || p.build === 'pixel' ? BOX.cy : H / 2; s = mapPts(s, ([x, y]) => [x - k * (y - my), y]); }
200
+ return tidy(s, { share: 0.004, width: 10 });
201
+ }
202
+
203
+ /** A pixel letter is many pieces and sparse (an L, a T); a slab's tips are sharp. */
204
+ export const guard = { maxPieces: 40, maxThinShare: 0.08, minInkShare: 0.08 };
@@ -0,0 +1,142 @@
1
+ /**
2
+ * Line: ONE heavy stroke walked through three to six points of a 4 × 4 lattice, mitred or rounded at its turns, with
3
+ * round, square or angled ends and ONE optional move: a round loop at a turn, a hairpin fold at its end, or its start
4
+ * crossing its end with a gap (over and under). After monoline marks: a looped A, a hooked path, a folded stroke.
5
+ * Banned reads: never two loops; a four-point zigzag is the lightning bolt and three points with a short first leg at a
6
+ * right angle are the tick icon, so those layouts are passed over for the next. A loop at the tip of a narrow V (its
7
+ * two legs opening under 100°) is the awareness ribbon, so a loop only goes at a wider turn, and a layout with none
8
+ * passes to the next walk.
9
+ */
10
+ import { U, D, poly, circle, stroke } from '@logomarks/core/geometry';
11
+ import { BOX, GAP, clear } from '../draw.js';
12
+ import { rng } from '../random.js';
13
+
14
+ /** @type {import('../index.js').Control[]} */
15
+ export const controls = [
16
+ { key: 'points', label: 'Points', type: 'range', min: 3, max: 6, step: 1, value: 4 },
17
+ { key: 'layout', label: 'Layout no.', type: 'range', min: 1, max: 999, step: 1, value: 9 },
18
+ { key: 'stroke', label: 'Stroke', type: 'range', min: 0.12, max: 0.22, step: 0.005, value: 0.16 },
19
+ { key: 'joins', label: 'Joins', type: 'choice', options: ['round', 'mitre'], value: 'round' },
20
+ { key: 'caps', label: 'Ends', type: 'choice', options: ['round', 'square', 'angled'], value: 'round' },
21
+ { key: 'move', label: 'Move', type: 'choice', options: ['none', 'loop', 'fold', 'overlap'], value: 'loop' },
22
+ ];
23
+
24
+ /** A lattice point (i, j from 0 to 3) on the box. */
25
+ const at = (i, j) => [BOX.x0 + (i * BOX.size) / 3, BOX.y0 + (j * BOX.size) / 3];
26
+
27
+ /** Whether segments ab and cd cross (strictly). */
28
+ function crosses(a, b, c, d) {
29
+ const o = (p, q, r) => Math.sign((q[0] - p[0]) * (r[1] - p[1]) - (q[1] - p[1]) * (r[0] - p[0]));
30
+ return o(a, b, c) * o(a, b, d) < 0 && o(c, d, a) * o(c, d, b) < 0;
31
+ }
32
+
33
+ /** The turn at b, in degrees (0 straight on, 180 straight back). */
34
+ function turnAt(a, b, c) {
35
+ const u = [b[0] - a[0], b[1] - a[1]], v = [c[0] - b[0], c[1] - b[1]];
36
+ return (Math.acos(Math.max(-1, Math.min(1, (u[0] * v[0] + u[1] * v[1]) / (Math.hypot(...u) * Math.hypot(...v))))) * 180) / Math.PI;
37
+ }
38
+
39
+ /** A walk of n lattice points from a seed: no repeats, no crossing itself, every turn between 30° and 150°. */
40
+ function walk(rand, n) {
41
+ for (let tries = 0; tries < 60; tries++) {
42
+ const pts = [[Math.floor(rand() * 4), Math.floor(rand() * 4)]];
43
+ while (pts.length < n) {
44
+ const options = [];
45
+ for (let i = 0; i < 4; i++) for (let j = 0; j < 4; j++) {
46
+ const q = [i, j], last = pts.at(-1);
47
+ if (pts.some((p) => p[0] === i && p[1] === j) || Math.hypot(i - last[0], j - last[1]) < 1.4) continue;
48
+ const P = pts.map(([a, b]) => at(a, b)), Q = at(i, j), L = P.at(-1);
49
+ if (pts.length >= 2) { const t = turnAt(P.at(-2), L, Q); if (t < 30 || t > 150) continue; }
50
+ if (P.slice(0, -2).some((p, k) => crosses(p, P[k + 1], L, Q))) continue;
51
+ options.push(q);
52
+ }
53
+ if (!options.length) break;
54
+ pts.push(options[Math.floor(rand() * options.length)]);
55
+ }
56
+ if (pts.length === n) return pts.map(([i, j]) => at(i, j));
57
+ }
58
+ return null;
59
+ }
60
+
61
+ /** Whether a walk is a banned read: a four-point zigzag (the bolt) or a short-legged right angle (the tick). */
62
+ function banned(pts) {
63
+ if (pts.length === 4) {
64
+ const s1 = Math.sign((pts[1][0] - pts[0][0]) * (pts[2][1] - pts[1][1]) - (pts[1][1] - pts[0][1]) * (pts[2][0] - pts[1][0]));
65
+ const s2 = Math.sign((pts[2][0] - pts[1][0]) * (pts[3][1] - pts[2][1]) - (pts[2][1] - pts[1][1]) * (pts[3][0] - pts[2][0]));
66
+ if (s1 !== s2 && turnAt(pts[0], pts[1], pts[2]) > 100 && turnAt(pts[1], pts[2], pts[3]) > 100) return true;
67
+ }
68
+ if (pts.length === 3) {
69
+ const l1 = Math.hypot(pts[1][0] - pts[0][0], pts[1][1] - pts[0][1]), l2 = Math.hypot(pts[2][0] - pts[1][0], pts[2][1] - pts[1][1]);
70
+ if (Math.abs(turnAt(...pts) - 90) < 20 && l1 < l2 * 0.6) return true;
71
+ }
72
+ return false;
73
+ }
74
+
75
+ /**
76
+ * One cursive loop at point k: the stroke runs on past the turn, circles round outside it (a circle tangent to both legs
77
+ * run on past the point) and comes back through the point along the next leg, crossing itself there.
78
+ */
79
+ function withLoop(pts, k, w) {
80
+ const [a, v, b] = [pts[k - 1], pts[k], pts[k + 1]];
81
+ const unit = (x, y) => { const l = Math.hypot(x, y) || 1; return [x / l, y / l]; };
82
+ const u1 = unit(v[0] - a[0], v[1] - a[1]), u2 = unit(b[0] - v[0], b[1] - v[1]);
83
+ const alpha = Math.acos(Math.max(-1, Math.min(1, -(u1[0] * u2[0] + u1[1] * u2[1])))); // between u1 and −u2
84
+ const R = w * 0.95 + GAP, s = R / Math.tan(alpha / 2), d = R / Math.sin(alpha / 2);
85
+ const bis = unit(u1[0] - u2[0], u1[1] - u2[1]), c = [v[0] + bis[0] * d, v[1] + bis[1] * d];
86
+ const T1 = [v[0] + u1[0] * s, v[1] + u1[1] * s], T2 = [v[0] - u2[0] * s, v[1] - u2[1] * s];
87
+ const a1 = Math.atan2(T1[1] - c[1], T1[0] - c[0]), a2 = Math.atan2(T2[1] - c[1], T2[0] - c[0]);
88
+ const dir = Math.sign((T1[0] - c[0]) * u1[1] - (T1[1] - c[1]) * u1[0]) || 1;
89
+ let sweep = a2 - a1;
90
+ if (dir > 0) { while (sweep <= 0) sweep += Math.PI * 2; } else { while (sweep >= 0) sweep -= Math.PI * 2; }
91
+ const arc = Array.from({ length: 49 }, (_, i) => { const t = a1 + (sweep * i) / 48; return [c[0] + R * Math.cos(t), c[1] + R * Math.sin(t)]; });
92
+ return [...pts.slice(0, k), ...arc, ...pts.slice(k + 1)];
93
+ }
94
+
95
+ /** The stroke along a path: mitred, or with a disc at each turn for round joins; round or square caps. */
96
+ function line(pts, w, p) {
97
+ const s = stroke(pts, w, { roundCaps: p.caps === 'round' });
98
+ if (p.joins !== 'round') return s;
99
+ return U(s, ...pts.slice(1, -1).map(([x, y]) => circle(x, y, w / 2, 32)));
100
+ }
101
+
102
+ /** An end cut at 45° across the stroke: a triangle off the end's corner. */
103
+ function angled(s, end, prev, w) {
104
+ const ux = (end[0] - prev[0]) / Math.hypot(end[0] - prev[0], end[1] - prev[1]), uy = (end[1] - prev[1]) / Math.hypot(end[0] - prev[0], end[1] - prev[1]);
105
+ const nx = -uy, ny = ux, h = w / 2;
106
+ return D(s, poly([[end[0] + nx * h + ux * 2, end[1] + ny * h + uy * 2], [end[0] + nx * h - ux * w, end[1] + ny * h - uy * w], [end[0] - nx * h + ux * 2, end[1] - ny * h + uy * 2]]));
107
+ }
108
+
109
+ /** The mark for resolved params. */
110
+ export function build(p) {
111
+ const w = p.stroke * BOX.size;
112
+ const loopAt = (q) => {
113
+ // one loop only, at the gentlest turn (a sharp one throws the loop far out), and never where the legs open under
114
+ // 100° (a turn over 80°): a loop on a narrow V is the awareness ribbon
115
+ let k = -1, best = 999;
116
+ for (let i = 1; i < q.length - 1; i++) { const t = turnAt(q[i - 1], q[i], q[i + 1]); if (t <= 80 && t < best) { best = t; k = i; } }
117
+ return k;
118
+ };
119
+ let pts = null;
120
+ for (let k = 0; k < 12 && !pts; k++) {
121
+ const q = walk(rng(`line:${p.layout}:${p.points}:${k}`), p.points);
122
+ if (q && !banned(q) && (p.move !== 'loop' || loopAt(q) > 0)) pts = q;
123
+ }
124
+ if (!pts) return [];
125
+ if (p.move === 'loop' && pts.length >= 3) return line(withLoop(pts, loopAt(pts), w), w, p);
126
+ if (p.move === 'fold') {
127
+ // a hairpin: the last leg comes back alongside itself, a gap apart, for half its length
128
+ const e = pts.at(-1), b = pts.at(-2), L = Math.hypot(e[0] - b[0], e[1] - b[1]), ux = (e[0] - b[0]) / L, uy = (e[1] - b[1]) / L, off = w + GAP;
129
+ const back = [[e[0] - uy * off, e[1] + ux * off], [e[0] - uy * off - ux * L * 0.5, e[1] + ux * off - uy * L * 0.5]];
130
+ return line([...pts, ...back], w, p);
131
+ }
132
+ if (p.move === 'overlap' && pts.length >= 3) {
133
+ // the end runs on across the first leg; the first leg passes under it, cleared by the gap
134
+ const a = pts[0], b = pts[1], m = [(a[0] + b[0]) / 2, (a[1] + b[1]) / 2], e = pts.at(-1);
135
+ const dx = m[0] - e[0], dy = m[1] - e[1], dl = Math.hypot(dx, dy) || 1, tail = [m[0] + (dx / dl) * w * 1.6, m[1] + (dy / dl) * w * 1.6];
136
+ const first = line(pts.slice(0, 2), w, p), rest = line([...pts.slice(1), tail], w, p);
137
+ return U(clear(first, rest, GAP), rest);
138
+ }
139
+ let s = line(pts, w, p);
140
+ if (p.caps === 'angled') s = angled(angled(s, pts.at(-1), pts.at(-2), w), pts[0], pts[1], w);
141
+ return s;
142
+ }
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Links: two or three loops (rings, rounded squares or pills) linked like a chain, each crossing woven: over on one
3
+ * side, under on the other, cut free by the house gap; in a row, on a diagonal, or three round a triangle. Never more
4
+ * than three, and never the five-ring layout.
5
+ */
6
+ import { U, D, I, rect, rr, circle, rot, grown } from '@logomarks/core/geometry';
7
+ import { BOX, GAP } from '../draw.js';
8
+
9
+ /** @type {import('../index.js').Control[]} */
10
+ export const controls = [
11
+ { key: 'count', label: 'Loops', type: 'range', min: 2, max: 3, step: 1, value: 2 },
12
+ { key: 'loop', label: 'Loop', type: 'choice', options: ['ring', 'rounded', 'pill'], value: 'rounded' },
13
+ { key: 'layout', label: 'Arrangement', type: 'choice', options: ['row', 'diagonal', 'triangle'], value: 'diagonal' },
14
+ { key: 'weight', label: 'Weight', type: 'range', min: 0.07, max: 0.16, step: 0.005, value: 0.11 },
15
+ { key: 'overlap', label: 'Overlap', type: 'range', min: 0.15, max: 0.45, step: 0.01, value: 0.3 },
16
+ { key: 'corner', label: 'Corner', type: 'range', min: 0.1, max: 0.5, step: 0.01, value: 0.32 },
17
+ ];
18
+
19
+ /** A loop of outer size w × h centred at (x, y), `t` thick. */
20
+ function loop(kind, x, y, w, h, t, corner) {
21
+ if (kind === 'ring') { const r = Math.min(w, h) / 2; return D(circle(x, y, r, 72), circle(x, y, r - t, 72)); }
22
+ const rad = kind === 'pill' ? Math.min(w, h) / 2 : Math.min(w, h) * corner;
23
+ const inner = Math.max(0, rad - t);
24
+ return D(rr(x - w / 2, y - h / 2, w, h, rad), rr(x - w / 2 + t, y - h / 2 + t, w - 2 * t, h - 2 * t, inner));
25
+ }
26
+
27
+ /** The half plane to one side of the line from a to b (the left, seen walking from a to b). */
28
+ function side(a, b) {
29
+ const ang = (Math.atan2(b[1] - a[1], b[0] - a[0]) * 180) / Math.PI, mx = (a[0] + b[0]) / 2, my = (a[1] + b[1]) / 2;
30
+ return rot(rect(mx - 800, my - 800, 1600, 800), ang, mx, my);
31
+ }
32
+
33
+ /** The mark for resolved params. */
34
+ export function build(p) {
35
+ const n = p.count, t = p.weight * BOX.size, { cx, cy, size } = BOX;
36
+ const tri = p.layout === 'triangle' && n === 3;
37
+ // the loop size: n loops overlapping by `overlap` of a loop fill the box along the arrangement
38
+ const along = p.layout === 'diagonal' ? size * 1.0 : size;
39
+ const s = tri ? size / (2 - p.overlap) : along / (n - (n - 1) * p.overlap);
40
+ const pill = p.loop === 'pill';
41
+ const w = pill ? s : s, h = pill ? s * 0.56 : s;
42
+ let centres;
43
+ if (tri) centres = [[cx, cy - (size - s) / 2], [cx - (size - s) / 2, cy + (size - s) / 2], [cx + (size - s) / 2, cy + (size - s) / 2]];
44
+ else if (p.layout === 'diagonal') { const step = (size - s) / (n - 1); centres = Array.from({ length: n }, (_, k) => [BOX.x0 + s / 2 + k * step, BOX.y0 + s / 2 + k * step]); }
45
+ else { const step = (size - w) / (n - 1); centres = Array.from({ length: n }, (_, k) => [BOX.x0 + w / 2 + k * step, cy]); }
46
+ const loops = centres.map(([x, y]) => loop(p.loop, x, y, w, h, t, p.corner));
47
+ let acc = loops[0];
48
+ for (let k = 1; k < n; k++) {
49
+ const a = centres[k - 1], b = centres[k], half = side(a, b), L = loops[k];
50
+ // woven: the new loop over on one side of the line between the centres, under on the other
51
+ const flip = k % 2 === 0;
52
+ // over and under: only the loop before touches the new one, so only those two are grown for the gap
53
+ const upper = U(D(acc, grown(L, GAP)), L), lower = U(D(L, grown(loops[k - 1], GAP)), acc);
54
+ acc = U(I(flip ? lower : upper, half), D(flip ? upper : lower, half));
55
+ }
56
+ if (tri) {
57
+ // the third crossing, between the last loop and the first
58
+ const a = centres[2], b = centres[0], half = side(a, b);
59
+ const upper = U(D(acc, grown(loops[0], GAP)), loops[0]), lower = U(D(loops[0], grown(loops[2], GAP)), D(acc, loops[0]));
60
+ acc = U(I(upper, half), D(lower, half));
61
+ }
62
+ return acc;
63
+ }
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Orbit: a planet (a disc, or a ring) and one or two tilted elliptical rings round it, each passing in front of the
3
+ * planet across its near half and behind it across its far half, cut free by the house gap at every crossing; a moon
4
+ * if asked. After Saturn-style orbit marks.
5
+ */
6
+ import { D, I, ellipse, circle, rect, rot, over, annulus } from '@logomarks/core/geometry';
7
+ import { BOX, GAP, tidy } from '../draw.js';
8
+
9
+ /** @type {import('../index.js').Control[]} */
10
+ export const controls = [
11
+ { key: 'planet', label: 'Planet size', type: 'range', min: 0.24, max: 0.42, step: 0.01, value: 0.36 },
12
+ { key: 'body', label: 'Planet', type: 'choice', options: ['solid', 'ring'], value: 'solid' },
13
+ { key: 'rings', label: 'Rings', type: 'range', min: 1, max: 2, step: 1, value: 1 },
14
+ { key: 'width', label: 'Ring width', type: 'range', min: 0.05, max: 0.12, step: 0.005, value: 0.075 },
15
+ { key: 'flatten', label: 'Ring depth', type: 'range', min: 0.16, max: 0.4, step: 0.01, value: 0.22 },
16
+ { key: 'tilt', label: 'Tilt', type: 'range', min: -40, max: 40, step: 1, value: -16 },
17
+ { key: 'moon', label: 'Moon', type: 'choice', options: ['none', 'beside'], value: 'none' },
18
+ ];
19
+
20
+ /** An elliptical band round the centre, rx across, ry deep, w wide, turned `deg`. */
21
+ function band(rx, ry, w, deg) {
22
+ const { cx, cy } = BOX;
23
+ return rot(D(ellipse(cx, cy, rx, ry, 0, 72), ellipse(cx, cy, rx - w, Math.max(2, ry - w), 0, 72)), deg, cx, cy);
24
+ }
25
+
26
+ /** The near half of the plane for a ring turned `deg` (below its long axis). */
27
+ function near(deg) {
28
+ const { cx, cy } = BOX;
29
+ return rot(rect(cx - 600, cy, 1200, 600), deg, cx, cy);
30
+ }
31
+
32
+ /** The mark for resolved params. */
33
+ export function build(p) {
34
+ const { cx, cy, size } = BOX, R = p.planet * size * 0.75 + size * 0.02;
35
+ const w = p.width * size, rx = size / 2;
36
+ let s = p.body === 'ring' ? annulus(cx, cy, R - w * 0.75, w * 1.5) : circle(cx, cy, R, 72);
37
+ const tilts = p.rings === 2 ? [p.tilt, -p.tilt * 0.6 + (p.tilt >= 0 ? -28 : 28)] : [p.tilt];
38
+ for (const [k, deg] of tilts.entries()) {
39
+ const ry = rx * p.flatten * (k ? 0.9 : 1), ring = band(rx * (k ? 0.92 : 1), ry, w, deg);
40
+ const front = I(ring, near(deg)), back = D(ring, near(deg));
41
+ s = over(over(back, s, GAP), front, GAP);
42
+ }
43
+ if (p.moon === 'beside') {
44
+ // a moon off the planet's upper shoulder, on the side the ring rises toward
45
+ const m = Math.max(w * 0.9, size * 0.05), sx = p.tilt <= 0 ? 1 : -1;
46
+ s = over(s, circle(cx + sx * R * 1.2, cy - R * 1.2, m, 48), GAP);
47
+ }
48
+ // where a ring slips behind the planet at a shallow angle, the gap leaves thin tails: dropped
49
+ return tidy(s, { share: 0.01, width: 18 });
50
+ }
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Pixel: a pixel figure on a 5, 7 or 9 wide grid, mirrored left to right (a face-free identicon), drawn from a numbered
3
+ * layout at a density, the pixels joined into solid shapes or parted by a gap. A left-right mirror alone often makes a
4
+ * face or a video-game alien, so the default mirrors both ways (an ornament). After the pixel ornaments and the pixel
5
+ * families.
6
+ */
7
+ import { U, rect, rr } from '@logomarks/core/geometry';
8
+ import { BOX, GAP } from '../draw.js';
9
+ import { rng } from '../random.js';
10
+
11
+ /** @type {import('../index.js').Control[]} */
12
+ export const controls = [
13
+ { key: 'grid', label: 'Grid', type: 'choice', options: ['5', '7', '9'], value: '7' },
14
+ { key: 'layout', label: 'Layout no.', type: 'range', min: 1, max: 999, step: 1, value: 21 },
15
+ { key: 'density', label: 'Density', type: 'range', min: 0.3, max: 0.75, step: 0.01, value: 0.5 },
16
+ { key: 'symmetry', label: 'Symmetry', type: 'choice', options: ['both', 'mirror', 'turn'], value: 'both' },
17
+ { key: 'parted', label: 'Parted', type: 'toggle', value: false },
18
+ { key: 'pixel', label: 'Pixel', type: 'choice', options: ['square', 'rounded', 'dot'], value: 'square' },
19
+ ];
20
+
21
+ /** The mark for resolved params. */
22
+ export function build(p) {
23
+ const n = Number(p.grid), rand = rng(`pixel:${p.layout}:${n}`), on = Array.from({ length: n }, () => Array(n).fill(false));
24
+ const half = Math.ceil(n / 2);
25
+ for (let j = 0; j < n; j++) for (let i = 0; i < half; i++) on[j][i] = rand() < p.density;
26
+ for (let j = 0; j < n; j++) for (let i = half; i < n; i++) on[j][i] = p.symmetry === 'turn' ? on[n - 1 - j][n - 1 - i] : on[j][n - 1 - i];
27
+ if (p.symmetry === 'both') for (let j = half; j < n; j++) for (let i = 0; i < n; i++) on[j][i] = on[n - 1 - j][i];
28
+ const g = p.parted ? GAP * 0.8 : 0, c = (BOX.size - (n - 1) * g) / n, parts = [];
29
+ for (let j = 0; j < n; j++) for (let i = 0; i < n; i++) {
30
+ if (!on[j][i]) continue;
31
+ const x = BOX.x0 + i * (c + g), y = BOX.y0 + j * (c + g);
32
+ parts.push(p.pixel === 'dot' ? rr(x, y, c, c, c / 2) : p.pixel === 'rounded' ? rr(x, y, c, c, c * 0.28) : rect(x - (g ? 0 : 0.01), y - (g ? 0 : 0.01), c + (g ? 0 : 0.02), c + (g ? 0 : 0.02)));
33
+ }
34
+ return parts.length ? U(...parts) : [];
35
+ }
36
+
37
+ /** A parted pixel figure is many pieces. */
38
+ export const guard = { maxPieces: 60 };