@thi.ng/geom 5.2.13 → 6.0.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.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2023-10-27T16:56:24Z
3
+ - **Last updated**: 2023-11-01T11:05:34Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
@@ -9,6 +9,13 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
9
9
  **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
10
10
  and/or version bumps of transitive dependencies.
11
11
 
12
+ # [6.0.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/geom@6.0.0) (2023-11-01)
13
+
14
+ #### 🛑 Breaking changes
15
+
16
+ - update tessellate() for groups, update return type ([1bb1752](https://github.com/thi-ng/umbrella/commit/1bb1752))
17
+ - BREAKING CHANGE: update tessellate() for groups, update return type to Iterable
18
+
12
19
  ### [5.2.13](https://github.com/thi-ng/umbrella/tree/@thi.ng/geom@5.2.13) (2023-10-27)
13
20
 
14
21
  #### ♻️ Refactoring
package/README.md CHANGED
@@ -200,7 +200,7 @@ For Node.js REPL:
200
200
  const geom = await import("@thi.ng/geom");
201
201
  ```
202
202
 
203
- Package sizes (brotli'd, pre-treeshake): ESM: 12.76 KB
203
+ Package sizes (brotli'd, pre-treeshake): ESM: 12.77 KB
204
204
 
205
205
  ## Dependencies
206
206
 
@@ -234,11 +234,9 @@ Package sizes (brotli'd, pre-treeshake): ESM: 12.76 KB
234
234
 
235
235
  ## Usage examples
236
236
 
237
- Several demos in this repo's
237
+ Several projects in this repo's
238
238
  [/examples](https://github.com/thi-ng/umbrella/tree/develop/examples)
239
- directory are using this package.
240
-
241
- A selection:
239
+ directory are using this package:
242
240
 
243
241
  | Screenshot | Description | Live demo | Source |
244
242
  |:-----------------------------------------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------|:------------------------------------------------------------|:-----------------------------------------------------------------------------------------|
@@ -257,6 +255,7 @@ A selection:
257
255
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/imgui/imgui-all.png" width="240"/> | Canvas based Immediate Mode GUI components | [Demo](https://demo.thi.ng/umbrella/imgui/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/imgui) |
258
256
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/geom/geom-isoline.png" width="240"/> | Animated sine plasma effect visualized using contour lines | [Demo](https://demo.thi.ng/umbrella/iso-plasma/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/iso-plasma) |
259
257
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/kmeans-viz.jpg" width="240"/> | k-means clustering visualization | [Demo](https://demo.thi.ng/umbrella/kmeans-viz/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/kmeans-viz) |
258
+ | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/pointfree-geom.jpg" width="240"/> | Live coding playground for 2D geometry generation using @thi.ng/pointfree-lang | [Demo](https://demo.thi.ng/umbrella/pointfree-geom/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/pointfree-geom) |
260
259
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/poisson/poisson.jpg" width="240"/> | 2D Poisson-disc sampler with procedural gradient map | [Demo](https://demo.thi.ng/umbrella/poisson-circles/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/poisson-circles) |
261
260
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/poly-spline.png" width="240"/> | Polygon to cubic curve conversion & visualization | [Demo](https://demo.thi.ng/umbrella/poly-spline/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/poly-spline) |
262
261
  | <img src="https://raw.githubusercontent.com/thi-ng/umbrella/develop/assets/examples/poly-subdiv.jpg" width="240"/> | Animated, iterative polygon subdivisions & visualization | [Demo](https://demo.thi.ng/umbrella/poly-subdiv/) | [Source](https://github.com/thi-ng/umbrella/tree/develop/examples/poly-subdiv) |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/geom",
3
- "version": "5.2.13",
3
+ "version": "6.0.0",
4
4
  "description": "Functional, polymorphic API for 2D geometry types & SVG generation",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -36,32 +36,32 @@
36
36
  },
37
37
  "dependencies": {
38
38
  "@thi.ng/api": "^8.9.6",
39
- "@thi.ng/arrays": "^2.7.0",
40
- "@thi.ng/associative": "^6.3.15",
39
+ "@thi.ng/arrays": "^2.7.1",
40
+ "@thi.ng/associative": "^6.3.16",
41
41
  "@thi.ng/checks": "^3.4.6",
42
- "@thi.ng/defmulti": "^3.0.2",
42
+ "@thi.ng/defmulti": "^3.0.3",
43
43
  "@thi.ng/equiv": "^2.1.31",
44
44
  "@thi.ng/errors": "^2.4.0",
45
- "@thi.ng/geom-api": "^3.4.41",
46
- "@thi.ng/geom-arc": "^2.1.84",
47
- "@thi.ng/geom-clip-line": "^2.3.41",
48
- "@thi.ng/geom-clip-poly": "^2.1.83",
49
- "@thi.ng/geom-closest-point": "^2.1.79",
50
- "@thi.ng/geom-hull": "^2.1.79",
51
- "@thi.ng/geom-isec": "^2.1.83",
52
- "@thi.ng/geom-poly-utils": "^2.3.67",
53
- "@thi.ng/geom-resample": "^2.3.5",
54
- "@thi.ng/geom-splines": "^2.2.58",
55
- "@thi.ng/geom-subdiv-curve": "^2.1.83",
56
- "@thi.ng/geom-tessellate": "^2.1.83",
57
- "@thi.ng/hiccup": "^5.0.3",
58
- "@thi.ng/hiccup-svg": "^5.0.29",
59
- "@thi.ng/math": "^5.7.0",
60
- "@thi.ng/matrices": "^2.2.3",
61
- "@thi.ng/random": "^3.6.10",
62
- "@thi.ng/strings": "^3.6.2",
63
- "@thi.ng/transducers": "^8.8.6",
64
- "@thi.ng/vectors": "^7.8.0"
45
+ "@thi.ng/geom-api": "^3.4.42",
46
+ "@thi.ng/geom-arc": "^2.1.85",
47
+ "@thi.ng/geom-clip-line": "^2.3.42",
48
+ "@thi.ng/geom-clip-poly": "^2.1.84",
49
+ "@thi.ng/geom-closest-point": "^2.1.80",
50
+ "@thi.ng/geom-hull": "^2.1.80",
51
+ "@thi.ng/geom-isec": "^2.1.84",
52
+ "@thi.ng/geom-poly-utils": "^2.3.68",
53
+ "@thi.ng/geom-resample": "^2.3.6",
54
+ "@thi.ng/geom-splines": "^2.2.59",
55
+ "@thi.ng/geom-subdiv-curve": "^2.1.84",
56
+ "@thi.ng/geom-tessellate": "^2.1.85",
57
+ "@thi.ng/hiccup": "^5.0.4",
58
+ "@thi.ng/hiccup-svg": "^5.0.30",
59
+ "@thi.ng/math": "^5.7.1",
60
+ "@thi.ng/matrices": "^2.2.5",
61
+ "@thi.ng/random": "^3.6.11",
62
+ "@thi.ng/strings": "^3.6.3",
63
+ "@thi.ng/transducers": "^8.8.7",
64
+ "@thi.ng/vectors": "^7.8.1"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@microsoft/api-extractor": "^7.38.0",
@@ -398,5 +398,5 @@
398
398
  ],
399
399
  "year": 2013
400
400
  },
401
- "gitHead": "502e8fa937677ff7bc4fbd0906d8c8b4b0b471e5\n"
401
+ "gitHead": "351014d081cee85803950eb6751c5a02dca2efbd\n"
402
402
  }
package/tessellate.d.ts CHANGED
@@ -8,12 +8,13 @@ import type { Vec } from "@thi.ng/vectors";
8
8
  * more details.
9
9
  *
10
10
  * @remarks
11
- * Implemented for all shapes supported by {@link vertices}.
11
+ * Implemented for all shapes supported by {@link vertices}. For groups, every
12
+ * child shape will be tessellated individually.
12
13
  *
13
14
  * @param shape
14
15
  * @param tessellators
15
16
  */
16
- export declare const tessellate: import("@thi.ng/defmulti").MultiFn2<IShape<IShape<any>>, Tessellator[], Vec[][]>;
17
+ export declare const tessellate: import("@thi.ng/defmulti").MultiFn2<IShape<IShape<any>>, Tessellator[], Iterable<Vec[]>>;
17
18
  /**
18
19
  * Alias for thi.ng/geom-tessellate
19
20
  * [`earCut2`](https://docs.thi.ng/umbrella/geom-tessellate/functions/earCut2.html)
package/tessellate.js CHANGED
@@ -6,6 +6,8 @@ import { quadFan } from "@thi.ng/geom-tessellate/quad-fan";
6
6
  import { rimTris } from "@thi.ng/geom-tessellate/rim-tris";
7
7
  import { tessellate as _tessellate } from "@thi.ng/geom-tessellate/tessellate";
8
8
  import { triFan } from "@thi.ng/geom-tessellate/tri-fan";
9
+ import { mapcat } from "@thi.ng/transducers/mapcat";
10
+ import { Group } from "./api/group.js";
9
11
  import { __dispatch } from "./internal/dispatch.js";
10
12
  import { vertices } from "./vertices.js";
11
13
  /**
@@ -16,13 +18,15 @@ import { vertices } from "./vertices.js";
16
18
  * more details.
17
19
  *
18
20
  * @remarks
19
- * Implemented for all shapes supported by {@link vertices}.
21
+ * Implemented for all shapes supported by {@link vertices}. For groups, every
22
+ * child shape will be tessellated individually.
20
23
  *
21
24
  * @param shape
22
25
  * @param tessellators
23
26
  */
24
27
  export const tessellate = defmulti(__dispatch, {}, {
25
28
  [DEFAULT]: ($, fns) => _tessellate(vertices($), fns),
29
+ group: ($, fns) => mapcat((x) => _tessellate(vertices(x), fns), $.children),
26
30
  });
27
31
  /**
28
32
  * Alias for thi.ng/geom-tessellate