@thi.ng/geom-voronoi 2.2.57 → 2.3.1
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 +7 -1
- package/README.md +1 -1
- package/index.d.ts +22 -0
- package/index.js +47 -0
- package/package.json +16 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2023-
|
|
3
|
+
- **Last updated**: 2023-05-11T12:16:33Z
|
|
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/README.md
CHANGED
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.
|
|
3
|
+
"version": "2.3.1",
|
|
4
4
|
"description": "Fast, incremental 2D Delaunay & Voronoi mesh implementation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -34,23 +34,23 @@
|
|
|
34
34
|
"test": "testament test"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@thi.ng/api": "^8.8.
|
|
38
|
-
"@thi.ng/bitfield": "^2.2.
|
|
39
|
-
"@thi.ng/checks": "^3.3.
|
|
40
|
-
"@thi.ng/geom-clip-line": "^2.3.
|
|
41
|
-
"@thi.ng/geom-clip-poly": "^2.1.
|
|
42
|
-
"@thi.ng/geom-isec": "^2.1.
|
|
43
|
-
"@thi.ng/geom-poly-utils": "^2.3.
|
|
44
|
-
"@thi.ng/math": "^5.4.
|
|
45
|
-
"@thi.ng/quad-edge": "^3.1.
|
|
46
|
-
"@thi.ng/vectors": "^7.6.
|
|
37
|
+
"@thi.ng/api": "^8.8.1",
|
|
38
|
+
"@thi.ng/bitfield": "^2.2.28",
|
|
39
|
+
"@thi.ng/checks": "^3.3.13",
|
|
40
|
+
"@thi.ng/geom-clip-line": "^2.3.16",
|
|
41
|
+
"@thi.ng/geom-clip-poly": "^2.1.58",
|
|
42
|
+
"@thi.ng/geom-isec": "^2.1.58",
|
|
43
|
+
"@thi.ng/geom-poly-utils": "^2.3.42",
|
|
44
|
+
"@thi.ng/math": "^5.4.10",
|
|
45
|
+
"@thi.ng/quad-edge": "^3.1.28",
|
|
46
|
+
"@thi.ng/vectors": "^7.6.14"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@microsoft/api-extractor": "^7.34.
|
|
50
|
-
"@thi.ng/testament": "^0.3.
|
|
51
|
-
"rimraf": "^
|
|
49
|
+
"@microsoft/api-extractor": "^7.34.8",
|
|
50
|
+
"@thi.ng/testament": "^0.3.16",
|
|
51
|
+
"rimraf": "^5.0.0",
|
|
52
52
|
"tools": "^0.0.1",
|
|
53
|
-
"typedoc": "^0.
|
|
53
|
+
"typedoc": "^0.24.6",
|
|
54
54
|
"typescript": "^5.0.4"
|
|
55
55
|
},
|
|
56
56
|
"keywords": [
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
],
|
|
92
92
|
"year": 2016
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "20ab11b687a13228f6a8cecdc5f05ba9105122ea\n"
|
|
95
95
|
}
|