@thi.ng/geom-voronoi 2.2.57 → 2.3.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-04-08T11:09:50Z
3
+ - **Last updated**: 2023-04-25T15:38:18Z
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,12 @@ 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
+ ## [2.3.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/geom-voronoi@2.3.0) (2023-04-25)
13
+
14
+ #### 🚀 Features
15
+
16
+ - add delaunayQE/voronoiQE() methods ([c709053](https://github.com/thi-ng/umbrella/commit/c709053))
17
+
12
18
  ### [2.2.55](https://github.com/thi-ng/umbrella/tree/@thi.ng/geom-voronoi@2.2.55) (2023-03-27)
13
19
 
14
20
  #### ♻️ Refactoring
package/index.d.ts CHANGED
@@ -44,7 +44,29 @@ export declare class DVMesh<T> {
44
44
  */
45
45
  computeDual(): void;
46
46
  delaunay(bounds?: ReadonlyVec[]): Vec[][];
47
+ /**
48
+ * Advanced use only. Returns Delaunay triangles as arrays of raw
49
+ * [thi.ng/quad-edge
50
+ * Edges](https://docs.thi.ng/umbrella/quad-edge/classes/Edge.html).
51
+ *
52
+ * @remarks
53
+ * The actual vertex position associated with each edge can be obtained via
54
+ * `e.origin.pos`. Each edge (and each associated {@link Vertex}) also has a
55
+ * unique ID, accessible via `e.id` and `e.origin.id`.
56
+ */
57
+ delaunayQE(): Edge<Vertex<T>>[][];
47
58
  voronoi(bounds?: ReadonlyVec[]): Vec[][];
59
+ /**
60
+ * Advanced use only. Returns Voronoi cells as arrays of raw
61
+ * [thi.ng/quad-edge
62
+ * Edges](https://docs.thi.ng/umbrella/quad-edge/classes/Edge.html).
63
+ *
64
+ * @remarks
65
+ * The actual vertex position associated with each edge can be obtained via
66
+ * `e.origin.pos`. Each edge (and each associated {@link Vertex}) also has a
67
+ * unique ID, accessible via `e.id` and `e.origin.id`.
68
+ */
69
+ voronoiQE(): Edge<Vertex<T>>[][];
48
70
  edges(voronoi?: boolean, boundsMinMax?: VecPair): VecPair[];
49
71
  traverse(proc: Visitor<T>, edges?: boolean, e?: Edge<Vertex<T>>): void;
50
72
  }
package/index.js CHANGED
@@ -190,6 +190,31 @@ export class DVMesh {
190
190
  });
191
191
  return cells;
192
192
  }
193
+ /**
194
+ * Advanced use only. Returns Delaunay triangles as arrays of raw
195
+ * [thi.ng/quad-edge
196
+ * Edges](https://docs.thi.ng/umbrella/quad-edge/classes/Edge.html).
197
+ *
198
+ * @remarks
199
+ * The actual vertex position associated with each edge can be obtained via
200
+ * `e.origin.pos`. Each edge (and each associated {@link Vertex}) also has a
201
+ * unique ID, accessible via `e.id` and `e.origin.id`.
202
+ */
203
+ delaunayQE() {
204
+ const cells = [];
205
+ const usedEdges = defBitField(this.nextEID);
206
+ this.traverse((eab) => {
207
+ if (!usedEdges.at(eab.id)) {
208
+ const ebc = eab.lnext;
209
+ const eca = ebc.lnext;
210
+ cells.push([eab, ebc, eca]);
211
+ usedEdges.setAt(eab.id);
212
+ usedEdges.setAt(ebc.id);
213
+ usedEdges.setAt(eca.id);
214
+ }
215
+ });
216
+ return cells;
217
+ }
193
218
  voronoi(bounds) {
194
219
  const cells = [];
195
220
  const bc = bounds && centroid(bounds);
@@ -222,6 +247,28 @@ export class DVMesh {
222
247
  }, false);
223
248
  return cells;
224
249
  }
250
+ /**
251
+ * Advanced use only. Returns Voronoi cells as arrays of raw
252
+ * [thi.ng/quad-edge
253
+ * Edges](https://docs.thi.ng/umbrella/quad-edge/classes/Edge.html).
254
+ *
255
+ * @remarks
256
+ * The actual vertex position associated with each edge can be obtained via
257
+ * `e.origin.pos`. Each edge (and each associated {@link Vertex}) also has a
258
+ * unique ID, accessible via `e.id` and `e.origin.id`.
259
+ */
260
+ voronoiQE() {
261
+ const cells = [];
262
+ this.traverse((e) => {
263
+ const first = (e = e.rot);
264
+ const cell = [];
265
+ do {
266
+ cell.push(e);
267
+ } while ((e = e.lnext) !== first);
268
+ cells.push(cell);
269
+ }, false);
270
+ return cells;
271
+ }
225
272
  edges(voronoi = false, boundsMinMax) {
226
273
  const edges = [];
227
274
  this.traverse((e, visitedEdges) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/geom-voronoi",
3
- "version": "2.2.57",
3
+ "version": "2.3.0",
4
4
  "description": "Fast, incremental 2D Delaunay & Voronoi mesh implementation",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -37,13 +37,13 @@
37
37
  "@thi.ng/api": "^8.8.0",
38
38
  "@thi.ng/bitfield": "^2.2.27",
39
39
  "@thi.ng/checks": "^3.3.12",
40
- "@thi.ng/geom-clip-line": "^2.3.14",
41
- "@thi.ng/geom-clip-poly": "^2.1.56",
42
- "@thi.ng/geom-isec": "^2.1.56",
43
- "@thi.ng/geom-poly-utils": "^2.3.40",
44
- "@thi.ng/math": "^5.4.8",
40
+ "@thi.ng/geom-clip-line": "^2.3.15",
41
+ "@thi.ng/geom-clip-poly": "^2.1.57",
42
+ "@thi.ng/geom-isec": "^2.1.57",
43
+ "@thi.ng/geom-poly-utils": "^2.3.41",
44
+ "@thi.ng/math": "^5.4.9",
45
45
  "@thi.ng/quad-edge": "^3.1.27",
46
- "@thi.ng/vectors": "^7.6.12"
46
+ "@thi.ng/vectors": "^7.6.13"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@microsoft/api-extractor": "^7.34.4",
@@ -91,5 +91,5 @@
91
91
  ],
92
92
  "year": 2016
93
93
  },
94
- "gitHead": "3a56bc490f1e68754762a503d06327b5b34ff7eb\n"
94
+ "gitHead": "ca22f02a137c0a4e3a38ef81e82e2bc7e3c43849\n"
95
95
  }