@thi.ng/quad-edge 2.0.6 → 3.1.2

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,93 +1,85 @@
1
1
  # Change Log
2
2
 
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- ## [2.0.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/quad-edge@2.0.5...@thi.ng/quad-edge@2.0.6) (2021-10-28)
7
-
8
- **Note:** Version bump only for package @thi.ng/quad-edge
9
-
10
-
11
-
12
-
13
-
14
- ## [2.0.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/quad-edge@2.0.4...@thi.ng/quad-edge@2.0.5) (2021-10-28)
15
-
16
- **Note:** Version bump only for package @thi.ng/quad-edge
17
-
18
-
19
-
20
-
21
-
22
- ## [2.0.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/quad-edge@2.0.3...@thi.ng/quad-edge@2.0.4) (2021-10-25)
23
-
24
- **Note:** Version bump only for package @thi.ng/quad-edge
25
-
3
+ - **Last updated**: 2021-11-21T17:09:28Z
4
+ - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
26
5
 
6
+ All notable changes to this project will be documented in this file.
7
+ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelines.
27
8
 
9
+ **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
10
+ and/or version bumps of transitive dependencies.
28
11
 
12
+ ## [3.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/quad-edge@3.1.0) (2021-11-17)
29
13
 
30
- ## [2.0.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/quad-edge@2.0.2...@thi.ng/quad-edge@2.0.3) (2021-10-15)
31
-
32
- **Note:** Version bump only for package @thi.ng/quad-edge
33
-
34
-
35
-
36
-
37
-
38
- ## [2.0.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/quad-edge@2.0.1...@thi.ng/quad-edge@2.0.2) (2021-10-15)
39
-
40
- **Note:** Version bump only for package @thi.ng/quad-edge
41
-
42
-
43
-
44
-
45
-
46
- ## [2.0.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/quad-edge@2.0.0...@thi.ng/quad-edge@2.0.1) (2021-10-13)
47
-
48
- **Note:** Version bump only for package @thi.ng/quad-edge
49
-
50
-
14
+ #### 🚀 Features
51
15
 
16
+ - Using workspaces for local tools ([bf7a404](https://github.com/thi-ng/umbrella/commit/bf7a404))
17
+ Improving the overall build ergonomics
18
+ - introduced a tools workspaces
19
+ - imported it in all needed packages/examples
20
+ - inclusive project root
52
21
 
22
+ #### ♻️ Refactoring
53
23
 
54
- # [2.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/quad-edge@1.0.1...@thi.ng/quad-edge@2.0.0) (2021-10-12)
24
+ - testrunner to binary ([4ebbbb2](https://github.com/thi-ng/umbrella/commit/4ebbbb2))
25
+ this commit reverts (partly) changes made in:
26
+ ef346d7a8753590dc9094108a3d861a8dbd5dd2c
27
+ overall purpose is better testament ergonomics:
28
+ instead of having to pass NODE_OPTIONS with every invocation
29
+ having a binary to handle this for us.
55
30
 
31
+ # [3.0.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/quad-edge@3.0.0) (2021-11-03)
56
32
 
57
- ### Build System
33
+ #### 🛑 Breaking changes
58
34
 
59
- * major update of ALL pkgs (export maps, ESM only) ([0d1d6ea](https://github.com/thi-ng/umbrella/commit/0d1d6ea9fab2a645d6c5f2bf2591459b939c09b6))
35
+ - restructure Edge & ID handling ([9e12172](https://github.com/thi-ng/umbrella/commit/9e12172))
36
+ - BREAKING CHANGE: require explict ID args, add defEdge()
37
+ - replace static Edge.create() with defEdge()
38
+ - remove automatic ID generation and require explicit ID args for:
39
+ - defEdge()
40
+ - Edge.connect()
60
41
 
42
+ ### [2.0.1](https://github.com/thi-ng/umbrella/tree/@thi.ng/quad-edge@2.0.1) (2021-10-13)
61
43
 
62
- ### BREAKING CHANGES
44
+ #### ♻️ Refactoring
63
45
 
64
- * discontinue CommonJS & UMD versions
46
+ - update imports in all tests/pkgs ([effd591](https://github.com/thi-ng/umbrella/commit/effd591))
65
47
 
66
- - only ESM modules will be published from now on
67
- - CJS obsolete due to ESM support in recent versions of node:
68
- - i.e. launch NodeJS via:
69
- - `node --experimental-specifier-resolution=node --experimental-repl-await`
70
- - in the node REPL use `await import(...)` instead of `require()`
71
- - UMD obsolete due to widespread browser support for ESM
48
+ # [2.0.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/quad-edge@2.0.0) (2021-10-12)
72
49
 
73
- Also:
74
- - normalize/restructure/reorg all package.json files
75
- - cleanup all build scripts, remove obsolete
76
- - switch from mocha to @thi.ng/testament for all tests
50
+ #### 🛑 Breaking changes
77
51
 
52
+ - major update of ALL pkgs (export maps, ESM only) ([0d1d6ea](https://github.com/thi-ng/umbrella/commit/0d1d6ea))
53
+ - BREAKING CHANGE: discontinue CommonJS & UMD versions
54
+ - only ESM modules will be published from now on
55
+ - CJS obsolete due to ESM support in recent versions of node:
56
+ - i.e. launch NodeJS via:
57
+ - `node --experimental-specifier-resolution=node --experimental-repl-await`
58
+ - in the node REPL use `await import(...)` instead of `require()`
59
+ - UMD obsolete due to widespread browser support for ESM
60
+ Also:
61
+ - normalize/restructure/reorg all package.json files
62
+ - cleanup all build scripts, remove obsolete
63
+ - switch from mocha to [@thi.ng/testament](https://github.com/thi-ng/umbrella/tree/main/packages/testament) for all tests
78
64
 
65
+ #### ♻️ Refactoring
79
66
 
67
+ - update all test stubs ([f2d6d53](https://github.com/thi-ng/umbrella/commit/f2d6d53))
68
+ - update all tests in _all_ pkgs ([8b582bc](https://github.com/thi-ng/umbrella/commit/8b582bc))
69
+ - update all to use [@thi.ng/testament](https://github.com/thi-ng/umbrella/tree/main/packages/testament)
80
70
 
71
+ ### [0.2.22](https://github.com/thi-ng/umbrella/tree/@thi.ng/quad-edge@0.2.22) (2020-08-28)
81
72
 
73
+ #### ♻️ Refactoring
82
74
 
83
- # [0.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/quad-edge@0.1.4...@thi.ng/quad-edge@0.2.0) (2019-07-07)
75
+ - update delete op (TS4.0) ([591c924](https://github.com/thi-ng/umbrella/commit/591c924))
84
76
 
85
- ### Features
77
+ ## [0.2.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/quad-edge@0.2.0) (2019-07-07)
86
78
 
87
- - **quad-edge:** enable TS strict compiler flags (refactor) ([5a6cec1](https://github.com/thi-ng/umbrella/commit/5a6cec1))
79
+ #### 🚀 Features
88
80
 
89
- # 0.1.0 (2019-02-05)
81
+ - enable TS strict compiler flags (refactor) ([5a6cec1](https://github.com/thi-ng/umbrella/commit/5a6cec1))
90
82
 
91
- ### Features
83
+ #### ♻️ Refactoring
92
84
 
93
- - **quad-edge:** re-import & update quad edge impl (MBP2010) ([ee76797](https://github.com/thi-ng/umbrella/commit/ee76797))
85
+ - address TS strictNullChecks flag ([c95bc8f](https://github.com/thi-ng/umbrella/commit/c95bc8f))
package/README.md CHANGED
@@ -68,11 +68,11 @@ node --experimental-repl-await
68
68
  > const quadEdge = await import("@thi.ng/quad-edge");
69
69
  ```
70
70
 
71
- Package sizes (gzipped, pre-treeshake): ESM: 495 bytes
71
+ Package sizes (gzipped, pre-treeshake): ESM: 521 bytes
72
72
 
73
73
  ## Dependencies
74
74
 
75
- None
75
+ - [@thi.ng/errors](https://github.com/thi-ng/umbrella/tree/develop/packages/errors)
76
76
 
77
77
  ## API
78
78
 
package/index.d.ts CHANGED
@@ -1,13 +1,24 @@
1
- /**
2
- * Helper function to set / reset edge ID counter.
3
- *
4
- * @param id -
5
- */
6
- export declare const setNextID: (id: number) => number;
7
1
  /**
8
2
  * Type alias for a 4-tuple of {@link Edge} instances.
9
3
  */
10
4
  export declare type QuadEdge<T> = [Edge<T>, Edge<T>, Edge<T>, Edge<T>];
5
+ /**
6
+ * Main edge / quadedge factory function. Use this in preference of direct
7
+ * invocation of the {@link Edge} constructor.
8
+ *
9
+ * Creates new {@link QuadEdge} with 4 child edges and returns the first
10
+ * child/primary edge. If `src` and `dest` are given, they will be associated
11
+ * with that new edge as end points.
12
+ *
13
+ * @remarks
14
+ * The given `id` MUST be a multiple of 4.
15
+ *
16
+ * @param id -
17
+ * @param src -
18
+ * @param dest -
19
+ */
20
+ export declare function defEdge<T>(id: number): Edge<T>;
21
+ export declare function defEdge<T>(id: number, src: T, dest: T): Edge<T>;
11
22
  /**
12
23
  * Quad-edge implementation after Guibas & Stolfi. Based on C++ versions
13
24
  * by Paul Heckbert, Dani Lischinski et al:
@@ -18,18 +29,6 @@ export declare type QuadEdge<T> = [Edge<T>, Edge<T>, Edge<T>, Edge<T>];
18
29
  * - {@link http://www.cs.cmu.edu/afs/andrew/scs/cs/15-463/2001/pub/src/a2/lischinski/114.ps}
19
30
  */
20
31
  export declare class Edge<T> {
21
- /**
22
- * Main edge / quadedge factory function. Use this in preference of
23
- * direct invocation of the {@link Edge} constructor.
24
- *
25
- * Creates new {@link QuadEdge} with 4 child edges and returns the first
26
- * child/primary edge. If `src` and `dest` are not `null`ish, the
27
- * given args will be associated with that new edge as end points.
28
- *
29
- * @param src -
30
- * @param dest -
31
- */
32
- static create<T>(src?: T, dest?: T): Edge<T>;
33
32
  id: number;
34
33
  parent: QuadEdge<T>;
35
34
  origin: T;
@@ -96,7 +95,7 @@ export declare class Edge<T> {
96
95
  * @param d -
97
96
  */
98
97
  setEnds(o: T, d: T): void;
99
- connect(e: Edge<T>): Edge<T>;
98
+ connect(e: Edge<T>, id: number): Edge<T>;
100
99
  swap(): void;
101
100
  remove(): void;
102
101
  /**
package/index.js CHANGED
@@ -1,10 +1,18 @@
1
- let NEXT_ID = 0;
2
- /**
3
- * Helper function to set / reset edge ID counter.
4
- *
5
- * @param id -
6
- */
7
- export const setNextID = (id) => (NEXT_ID = (id + 3) & -4);
1
+ import { assert } from "@thi.ng/errors/assert";
2
+ export function defEdge(id, src, dest) {
3
+ assert((id & 3) === 0, `id must be multiple of 4`);
4
+ const quad = new Array(4);
5
+ const a = (quad[0] = new Edge(quad, id));
6
+ const b = (quad[1] = new Edge(quad, id + 1));
7
+ const c = (quad[2] = new Edge(quad, id + 2));
8
+ const d = (quad[3] = new Edge(quad, id + 3));
9
+ a.onext = a;
10
+ c.onext = c;
11
+ b.onext = d;
12
+ d.onext = b;
13
+ src && dest && a.setEnds(src, dest);
14
+ return a;
15
+ }
8
16
  /**
9
17
  * Quad-edge implementation after Guibas & Stolfi. Based on C++ versions
10
18
  * by Paul Heckbert, Dani Lischinski et al:
@@ -19,31 +27,6 @@ export class Edge {
19
27
  this.parent = parent;
20
28
  this.id = id;
21
29
  }
22
- /**
23
- * Main edge / quadedge factory function. Use this in preference of
24
- * direct invocation of the {@link Edge} constructor.
25
- *
26
- * Creates new {@link QuadEdge} with 4 child edges and returns the first
27
- * child/primary edge. If `src` and `dest` are not `null`ish, the
28
- * given args will be associated with that new edge as end points.
29
- *
30
- * @param src -
31
- * @param dest -
32
- */
33
- static create(src, dest) {
34
- const quad = new Array(4);
35
- const a = (quad[0] = new Edge(quad, NEXT_ID));
36
- const b = (quad[1] = new Edge(quad, NEXT_ID + 1));
37
- const c = (quad[2] = new Edge(quad, NEXT_ID + 2));
38
- const d = (quad[3] = new Edge(quad, NEXT_ID + 3));
39
- a.onext = a;
40
- c.onext = c;
41
- b.onext = d;
42
- d.onext = b;
43
- NEXT_ID += 4;
44
- src && dest && a.setEnds(src, dest);
45
- return a;
46
- }
47
30
  /**
48
31
  * Next CW edge from this edge's origin.
49
32
  */
@@ -127,8 +110,8 @@ export class Edge {
127
110
  this.origin = o;
128
111
  this.sym.origin = d;
129
112
  }
130
- connect(e) {
131
- const n = Edge.create();
113
+ connect(e, id) {
114
+ const n = defEdge(id);
132
115
  n.splice(this.lnext);
133
116
  n.sym.splice(e);
134
117
  n.setEnds(this.dest, e.origin);
package/package.json CHANGED
@@ -1,74 +1,82 @@
1
1
  {
2
- "name": "@thi.ng/quad-edge",
3
- "version": "2.0.6",
4
- "description": "Quadedge data structure after Guibas & Stolfi",
5
- "type": "module",
6
- "module": "./index.js",
7
- "typings": "./index.d.ts",
8
- "sideEffects": false,
9
- "repository": {
10
- "type": "git",
11
- "url": "https://github.com/thi-ng/umbrella.git"
2
+ "name": "@thi.ng/quad-edge",
3
+ "version": "3.1.2",
4
+ "description": "Quadedge data structure after Guibas & Stolfi",
5
+ "type": "module",
6
+ "module": "./index.js",
7
+ "typings": "./index.d.ts",
8
+ "sideEffects": false,
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/thi-ng/umbrella.git"
12
+ },
13
+ "homepage": "https://github.com/thi-ng/umbrella/tree/develop/packages/quad-edge#readme",
14
+ "funding": [
15
+ {
16
+ "type": "github",
17
+ "url": "https://github.com/sponsors/postspectacular"
12
18
  },
13
- "homepage": "https://github.com/thi-ng/umbrella/tree/develop/packages/quad-edge#readme",
14
- "funding": [
15
- {
16
- "type": "github",
17
- "url": "https://github.com/sponsors/postspectacular"
18
- },
19
- {
20
- "type": "patreon",
21
- "url": "https://patreon.com/thing_umbrella"
22
- }
19
+ {
20
+ "type": "patreon",
21
+ "url": "https://patreon.com/thing_umbrella"
22
+ }
23
+ ],
24
+ "author": "Karsten Schmidt <k+npm@thi.ng>",
25
+ "license": "Apache-2.0",
26
+ "scripts": {
27
+ "build": "yarn clean && tsc --declaration",
28
+ "clean": "rimraf '*.js' '*.d.ts' '*.map' doc",
29
+ "doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
30
+ "doc:ae": "mkdir -p .ae/doc .ae/temp && api-extractor run --local --verbose",
31
+ "doc:readme": "yarn doc:stats && tools:readme",
32
+ "doc:stats": "tools:module-stats",
33
+ "pub": "yarn npm publish --access public",
34
+ "test": "testament test"
35
+ },
36
+ "dependencies": {
37
+ "@thi.ng/errors": "^2.1.2"
38
+ },
39
+ "devDependencies": {
40
+ "@microsoft/api-extractor": "^7.18.19",
41
+ "@thi.ng/testament": "^0.2.2",
42
+ "rimraf": "^3.0.2",
43
+ "tools": "^0.0.1",
44
+ "typedoc": "^0.22.9",
45
+ "typescript": "^4.5.2"
46
+ },
47
+ "keywords": [
48
+ "2d",
49
+ "3d",
50
+ "adjacency",
51
+ "datastructure",
52
+ "dual",
53
+ "geometry",
54
+ "graph",
55
+ "mesh",
56
+ "quadedge",
57
+ "topology",
58
+ "typescript"
59
+ ],
60
+ "publishConfig": {
61
+ "access": "public"
62
+ },
63
+ "engines": {
64
+ "node": ">=12.7"
65
+ },
66
+ "files": [
67
+ "*.js",
68
+ "*.d.ts"
69
+ ],
70
+ "exports": {
71
+ ".": {
72
+ "import": "./index.js"
73
+ }
74
+ },
75
+ "thi.ng": {
76
+ "related": [
77
+ "geom-voronoi"
23
78
  ],
24
- "author": "Karsten Schmidt <k+npm@thi.ng>",
25
- "license": "Apache-2.0",
26
- "scripts": {
27
- "build": "yarn clean && tsc --declaration",
28
- "clean": "rimraf *.js *.d.ts *.map doc",
29
- "doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
30
- "doc:ae": "mkdir -p .ae/doc .ae/temp && node_modules/.bin/api-extractor run --local --verbose",
31
- "doc:readme": "yarn doc:stats && ../../scripts/node-esm ../../tools/src/readme.ts",
32
- "doc:stats": "../../scripts/node-esm ../../tools/src/module-stats.ts",
33
- "pub": "yarn build && yarn publish --access public",
34
- "test": "testament test"
35
- },
36
- "devDependencies": {
37
- "@thi.ng/testament": "^0.1.6"
38
- },
39
- "keywords": [
40
- "2d",
41
- "3d",
42
- "adjacency",
43
- "datastructure",
44
- "dual",
45
- "geometry",
46
- "graph",
47
- "mesh",
48
- "quadedge",
49
- "topology",
50
- "typescript"
51
- ],
52
- "publishConfig": {
53
- "access": "public"
54
- },
55
- "engines": {
56
- "node": ">=12.7"
57
- },
58
- "files": [
59
- "*.js",
60
- "*.d.ts"
61
- ],
62
- "exports": {
63
- ".": {
64
- "import": "./index.js"
65
- }
66
- },
67
- "thi.ng": {
68
- "related": [
69
- "geom-voronoi"
70
- ],
71
- "year": 2015
72
- },
73
- "gitHead": "c17a556ad25f6882dfa8f806a1d9e8ed7ac7cd71"
74
- }
79
+ "year": 2015
80
+ },
81
+ "gitHead": "e8a7c2a40191b391cef182c2978e5a6c85987a87\n"
82
+ }