@thi.ng/geom-voronoi 2.2.53 → 2.2.55
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/index.d.ts +3 -3
- package/index.js +7 -6
- package/package.json +16 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2023-03-
|
|
3
|
+
- **Last updated**: 2023-03-27T19:05:48Z
|
|
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.2.55](https://github.com/thi-ng/umbrella/tree/@thi.ng/geom-voronoi@2.2.55) (2023-03-27)
|
|
13
|
+
|
|
14
|
+
#### ♻️ Refactoring
|
|
15
|
+
|
|
16
|
+
- update imports (TS5.0) ([aa5da46](https://github.com/thi-ng/umbrella/commit/aa5da46))
|
|
17
|
+
|
|
12
18
|
## [2.2.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/geom-voronoi@2.2.0) (2021-11-17)
|
|
13
19
|
|
|
14
20
|
#### 🚀 Features
|
package/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Pair } from "@thi.ng/api";
|
|
2
|
-
import { BitField } from "@thi.ng/bitfield/bitfield";
|
|
3
|
-
import { Edge } from "@thi.ng/quad-edge";
|
|
4
|
-
import { ReadonlyVec, Vec, VecPair } from "@thi.ng/vectors/api";
|
|
2
|
+
import { type BitField } from "@thi.ng/bitfield/bitfield";
|
|
3
|
+
import { type Edge } from "@thi.ng/quad-edge";
|
|
4
|
+
import { type ReadonlyVec, type Vec, type VecPair } from "@thi.ng/vectors/api";
|
|
5
5
|
export type Visitor<T> = (e: Edge<Vertex<T>>, vistedEdges: BitField, visitedVerts: BitField) => void;
|
|
6
6
|
export interface Vertex<T> {
|
|
7
7
|
pos: ReadonlyVec;
|
package/index.js
CHANGED
|
@@ -7,10 +7,9 @@ import { centroid } from "@thi.ng/geom-poly-utils/centroid";
|
|
|
7
7
|
import { circumCenter2 } from "@thi.ng/geom-poly-utils/circumcenter";
|
|
8
8
|
import { EPS } from "@thi.ng/math/api";
|
|
9
9
|
import { defEdge } from "@thi.ng/quad-edge";
|
|
10
|
-
import { ZERO2 } from "@thi.ng/vectors/api";
|
|
10
|
+
import { ZERO2, } from "@thi.ng/vectors/api";
|
|
11
11
|
import { eqDelta2 } from "@thi.ng/vectors/eqdelta";
|
|
12
12
|
import { signedArea2 } from "@thi.ng/vectors/signed-area";
|
|
13
|
-
const rightOf = (p, e) => signedArea2(p, e.dest.pos, e.origin.pos) > 0;
|
|
14
13
|
export class DVMesh {
|
|
15
14
|
constructor(pts, size = 1e5) {
|
|
16
15
|
const a = { pos: [0, -size], id: 0 };
|
|
@@ -73,7 +72,7 @@ export class DVMesh {
|
|
|
73
72
|
// enforce delaunay constraints
|
|
74
73
|
do {
|
|
75
74
|
const t = e.oprev;
|
|
76
|
-
if (
|
|
75
|
+
if (isRightOf(t.dest.pos, e) &&
|
|
77
76
|
pointInCircumCircle(e.origin.pos, t.dest.pos, e.dest.pos, p)) {
|
|
78
77
|
e.swap();
|
|
79
78
|
e = e.oprev;
|
|
@@ -113,13 +112,13 @@ export class DVMesh {
|
|
|
113
112
|
eqDelta2(p, e.dest.pos, eps)) {
|
|
114
113
|
return [e, true];
|
|
115
114
|
}
|
|
116
|
-
else if (
|
|
115
|
+
else if (isRightOf(p, e)) {
|
|
117
116
|
e = e.sym;
|
|
118
117
|
}
|
|
119
|
-
else if (!
|
|
118
|
+
else if (!isRightOf(p, e.onext)) {
|
|
120
119
|
e = e.onext;
|
|
121
120
|
}
|
|
122
|
-
else if (!
|
|
121
|
+
else if (!isRightOf(p, e.dprev)) {
|
|
123
122
|
e = e.dprev;
|
|
124
123
|
}
|
|
125
124
|
else {
|
|
@@ -263,3 +262,5 @@ export class DVMesh {
|
|
|
263
262
|
}
|
|
264
263
|
}
|
|
265
264
|
}
|
|
265
|
+
/** @internal */
|
|
266
|
+
const isRightOf = (p, e) => signedArea2(p, e.dest.pos, e.origin.pos) > 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/geom-voronoi",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.55",
|
|
4
4
|
"description": "Fast, incremental 2D Delaunay & Voronoi mesh implementation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -34,24 +34,24 @@
|
|
|
34
34
|
"test": "testament test"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@thi.ng/api": "^8.7.
|
|
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.7.5",
|
|
38
|
+
"@thi.ng/bitfield": "^2.2.25",
|
|
39
|
+
"@thi.ng/checks": "^3.3.11",
|
|
40
|
+
"@thi.ng/geom-clip-line": "^2.3.12",
|
|
41
|
+
"@thi.ng/geom-clip-poly": "^2.1.54",
|
|
42
|
+
"@thi.ng/geom-isec": "^2.1.54",
|
|
43
|
+
"@thi.ng/geom-poly-utils": "^2.3.38",
|
|
44
|
+
"@thi.ng/math": "^5.4.6",
|
|
45
|
+
"@thi.ng/quad-edge": "^3.1.26",
|
|
46
|
+
"@thi.ng/vectors": "^7.6.10"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@microsoft/api-extractor": "^7.34.4",
|
|
50
|
-
"@thi.ng/testament": "^0.3.
|
|
51
|
-
"rimraf": "^4.4.
|
|
50
|
+
"@thi.ng/testament": "^0.3.14",
|
|
51
|
+
"rimraf": "^4.4.1",
|
|
52
52
|
"tools": "^0.0.1",
|
|
53
|
-
"typedoc": "^0.23.
|
|
54
|
-
"typescript": "^
|
|
53
|
+
"typedoc": "^0.23.28",
|
|
54
|
+
"typescript": "^5.0.2"
|
|
55
55
|
},
|
|
56
56
|
"keywords": [
|
|
57
57
|
"2d",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
],
|
|
92
92
|
"year": 2016
|
|
93
93
|
},
|
|
94
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "83b15b34326d480cbca0472b20390d4d3bbb792a\n"
|
|
95
95
|
}
|