@thi.ng/grid-iterators 2.3.21 → 2.3.22

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**: 2022-10-28T19:08:39Z
3
+ - **Last updated**: 2022-11-23T22:46:54Z
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.
@@ -45,12 +45,12 @@ and/or version bumps of transitive dependencies.
45
45
 
46
46
  #### 🚀 Features
47
47
 
48
+ - add floodFill(), update deps ([4634cf1](https://github.com/thi-ng/umbrella/commit/4634cf1))
49
+ - add flood fill functions ([65796b9](https://github.com/thi-ng/umbrella/commit/65796b9))
48
50
  - add clipped shape iterators ([611f0da](https://github.com/thi-ng/umbrella/commit/611f0da))
49
51
  - add generic clipped() filter iterator
50
52
  - add circleClipped()
51
53
  - add [hv]lineClipped()
52
- - add flood fill functions ([65796b9](https://github.com/thi-ng/umbrella/commit/65796b9))
53
- - add floodFill(), update deps ([4634cf1](https://github.com/thi-ng/umbrella/commit/4634cf1))
54
54
 
55
55
  #### 🩹 Bug fixes
56
56
 
@@ -58,20 +58,20 @@ and/or version bumps of transitive dependencies.
58
58
 
59
59
  #### ♻️ Refactoring
60
60
 
61
- - update floodFill() predicate type ([dec44e0](https://github.com/thi-ng/umbrella/commit/dec44e0))
62
- - update docs
61
+ - replace/re-use asInt() helper ([1b80de4](https://github.com/thi-ng/umbrella/commit/1b80de4))
63
62
  - update clipped shape iters ([dc065ed](https://github.com/thi-ng/umbrella/commit/dc065ed))
64
63
  - better pre-clipping for circle/line
65
64
  - intern intersection/clipping helpers
66
- - replace/re-use asInt() helper ([1b80de4](https://github.com/thi-ng/umbrella/commit/1b80de4))
65
+ - update floodFill() predicate type ([dec44e0](https://github.com/thi-ng/umbrella/commit/dec44e0))
66
+ - update docs
67
67
 
68
68
  ### [2.0.1](https://github.com/thi-ng/umbrella/tree/@thi.ng/grid-iterators@2.0.1) (2021-10-13)
69
69
 
70
70
  #### ♻️ Refactoring
71
71
 
72
- - update imports in all tests/pkgs ([effd591](https://github.com/thi-ng/umbrella/commit/effd591))
73
72
  - update imports in all pkgs ([5fa2b6f](https://github.com/thi-ng/umbrella/commit/5fa2b6f))
74
73
  - add .js suffix for all relative imports
74
+ - update imports in all tests/pkgs ([effd591](https://github.com/thi-ng/umbrella/commit/effd591))
75
75
 
76
76
  # [2.0.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/grid-iterators@2.0.0) (2021-10-12)
77
77
 
@@ -92,12 +92,12 @@ and/or version bumps of transitive dependencies.
92
92
 
93
93
  #### ♻️ Refactoring
94
94
 
95
- - minor pkg restructure (various) ([47f88d2](https://github.com/thi-ng/umbrella/commit/47f88d2))
96
- - update imports (transducers) ([cab1ea8](https://github.com/thi-ng/umbrella/commit/cab1ea8))
97
- - update imports ([138571a](https://github.com/thi-ng/umbrella/commit/138571a))
98
- - update all test stubs ([f2d6d53](https://github.com/thi-ng/umbrella/commit/f2d6d53))
99
95
  - update all tests in _all_ pkgs ([8b582bc](https://github.com/thi-ng/umbrella/commit/8b582bc))
100
96
  - update all to use [@thi.ng/testament](https://github.com/thi-ng/umbrella/tree/main/packages/testament)
97
+ - update all test stubs ([f2d6d53](https://github.com/thi-ng/umbrella/commit/f2d6d53))
98
+ - update imports ([138571a](https://github.com/thi-ng/umbrella/commit/138571a))
99
+ - update imports (transducers) ([cab1ea8](https://github.com/thi-ng/umbrella/commit/cab1ea8))
100
+ - minor pkg restructure (various) ([47f88d2](https://github.com/thi-ng/umbrella/commit/47f88d2))
101
101
 
102
102
  ### [0.4.24](https://github.com/thi-ng/umbrella/tree/@thi.ng/grid-iterators@0.4.24) (2021-03-03)
103
103
 
@@ -131,10 +131,10 @@ and/or version bumps of transitive dependencies.
131
131
 
132
132
  #### 🚀 Features
133
133
 
134
- - add zigzagDiagonal(), update readme, rename files ([5630055](https://github.com/thi-ng/umbrella/commit/5630055))
135
- - add interleave fns ([c883ea0](https://github.com/thi-ng/umbrella/commit/c883ea0))
136
- - add z-curve & random iterators, add deps ([ba8ed18](https://github.com/thi-ng/umbrella/commit/ba8ed18))
137
134
  - make row args optional ([60dccfc](https://github.com/thi-ng/umbrella/commit/60dccfc))
135
+ - add z-curve & random iterators, add deps ([ba8ed18](https://github.com/thi-ng/umbrella/commit/ba8ed18))
136
+ - add interleave fns ([c883ea0](https://github.com/thi-ng/umbrella/commit/c883ea0))
137
+ - add zigzagDiagonal(), update readme, rename files ([5630055](https://github.com/thi-ng/umbrella/commit/5630055))
138
138
 
139
139
  ## [0.1.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/grid-iterators@0.1.0) (2019-09-21)
140
140
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/grid-iterators",
3
- "version": "2.3.21",
3
+ "version": "2.3.22",
4
4
  "description": "2D grid and shape iterators w/ multiple orderings",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -35,20 +35,20 @@
35
35
  "test": "testament test"
36
36
  },
37
37
  "dependencies": {
38
- "@thi.ng/api": "^8.4.5",
39
- "@thi.ng/arrays": "^2.4.1",
40
- "@thi.ng/binary": "^3.3.9",
41
- "@thi.ng/bitfield": "^2.2.11",
42
- "@thi.ng/morton": "^3.1.20",
43
- "@thi.ng/random": "^3.3.14",
44
- "@thi.ng/transducers": "^8.3.22"
38
+ "@thi.ng/api": "^8.4.6",
39
+ "@thi.ng/arrays": "^2.4.2",
40
+ "@thi.ng/binary": "^3.3.10",
41
+ "@thi.ng/bitfield": "^2.2.12",
42
+ "@thi.ng/morton": "^3.1.21",
43
+ "@thi.ng/random": "^3.3.15",
44
+ "@thi.ng/transducers": "^8.3.23"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@microsoft/api-extractor": "^7.33.5",
48
- "@thi.ng/testament": "^0.3.4",
48
+ "@thi.ng/testament": "^0.3.5",
49
49
  "rimraf": "^3.0.2",
50
50
  "tools": "^0.0.1",
51
- "typedoc": "^0.23.18",
51
+ "typedoc": "^0.23.20",
52
52
  "typescript": "^4.8.4"
53
53
  },
54
54
  "keywords": [
@@ -76,8 +76,8 @@
76
76
  "node": ">=12.7"
77
77
  },
78
78
  "files": [
79
- "*.js",
80
- "*.d.ts"
79
+ "./*.js",
80
+ "./*.d.ts"
81
81
  ],
82
82
  "exports": {
83
83
  ".": {
@@ -152,5 +152,5 @@
152
152
  ],
153
153
  "year": 2019
154
154
  },
155
- "gitHead": "a4b60163a8caddceed5ec1b6b3584d164f61e7b6\n"
155
+ "gitHead": "044ee6a3895720fc78e115032d4d831b63510929\n"
156
156
  }
@@ -1,27 +0,0 @@
1
- import type { FnU7, FnU8, Tuple } from "@thi.ng/api";
2
- /**
3
- * Based on {@link @thi.ng/geom-isec}, but inlined to avoid dependency.
4
- *
5
- * @param x
6
- * @param y
7
- * @param w
8
- * @param h
9
- * @param cx
10
- * @param cy
11
- * @param r
12
- */
13
- export declare const intersectRectCircle: FnU7<number, boolean>;
14
- /**
15
- * Based on {@link @thi.ng/geom-clip-line#liangBarsky2Raw}, but with diff return type.
16
- *
17
- * @param ax
18
- * @param ay
19
- * @param bx
20
- * @param by
21
- * @param minx
22
- * @param miny
23
- * @param maxx
24
- * @param maxy
25
- */
26
- export declare const liangBarsky: FnU8<number, Tuple<number, 4> | undefined>;
27
- //# sourceMappingURL=clipping.d.ts.map
@@ -1,55 +0,0 @@
1
- const axis = (a, b, c) => (a < b ? a - b : a > b + c ? a - b - c : 0) ** 2;
2
- /**
3
- * Based on {@link @thi.ng/geom-isec}, but inlined to avoid dependency.
4
- *
5
- * @param x
6
- * @param y
7
- * @param w
8
- * @param h
9
- * @param cx
10
- * @param cy
11
- * @param r
12
- */
13
- export const intersectRectCircle = (x, y, w, h, cx, cy, r) => axis(cx, x, w) + axis(cy, y, h) <= r * r;
14
- /**
15
- * Based on {@link @thi.ng/geom-clip-line#liangBarsky2Raw}, but with diff return type.
16
- *
17
- * @param ax
18
- * @param ay
19
- * @param bx
20
- * @param by
21
- * @param minx
22
- * @param miny
23
- * @param maxx
24
- * @param maxy
25
- */
26
- export const liangBarsky = (ax, ay, bx, by, minx, miny, maxx, maxy) => {
27
- const dx = bx - ax;
28
- const dy = by - ay;
29
- let alpha = 0;
30
- let beta = 1;
31
- const clip = (p, q) => {
32
- if (p < 0) {
33
- const r = q / p;
34
- if (r > beta)
35
- return false;
36
- r > alpha && (alpha = r);
37
- }
38
- else if (p > 0) {
39
- const r = q / p;
40
- if (r < alpha)
41
- return false;
42
- r < beta && (beta = r);
43
- }
44
- else if (q < 0) {
45
- return false;
46
- }
47
- return true;
48
- };
49
- return clip(-dx, ax - minx) &&
50
- clip(dx, maxx - ax) &&
51
- clip(-dy, ay - miny) &&
52
- clip(dy, maxy - ay)
53
- ? [alpha * dx + ax, alpha * dy + ay, beta * dx + ax, beta * dy + ay]
54
- : undefined;
55
- };
@@ -1,68 +0,0 @@
1
- const g = require("@thi.ng/geom");
2
- const gi = require("@thi.ng/grid-iterators");
3
- const str = require("@thi.ng/strings");
4
- const fs = require("fs");
5
- const execSync = require("child_process").execSync;
6
-
7
- try {
8
- fs.mkdirSync("export");
9
- } catch (e) {}
10
-
11
- [
12
- gi.columns2d,
13
- gi.rows2d,
14
- gi.diagonal2d,
15
- gi.hilbert2d,
16
- gi.interleaveColumns2d,
17
- gi.interleaveRows2d,
18
- gi.random2d,
19
- gi.spiral2d,
20
- gi.zcurve2d,
21
- gi.zigzagColumns2d,
22
- gi.zigzagDiagonal2d,
23
- gi.zigzagRows2d,
24
- ].forEach((fn) => {
25
- console.log(`generating ${fn.name}...`);
26
- const pts = [...fn(16)];
27
- const base = `export/${fn.name.toLowerCase()}`;
28
- for (let i = 1; i <= 128; i++) {
29
- fs.writeFileSync(
30
- `${base}-${str.Z3(i)}.svg`,
31
- g.asSvg(
32
- g.svgDoc(
33
- {
34
- width: 600,
35
- height: 600,
36
- viewBox: "-1 -1 18 18",
37
- stroke: "black",
38
- "stroke-width": 0.1,
39
- },
40
- g.polyline(
41
- pts.slice(0, i * 2).map(([x, y]) => [x + 0.5, y + 0.5])
42
- ),
43
- g.group(
44
- { fill: [0, 1, 0.5, 0.25], stroke: "none" },
45
- pts.slice(0, i * 2 - 1).map((p) => g.rect(p, 1))
46
- ),
47
- g.rect(pts[i * 2 - 1], 1, {
48
- fill: [0, 1, 0.5, 0.85],
49
- stroke: "none",
50
- })
51
- )
52
- )
53
- );
54
- }
55
- console.log(`\tconverting to PNG...`);
56
- execSync(`../../scripts/svg2png ${base}*.svg`);
57
- console.log(`\tremoving SVG files...`);
58
- execSync(`rm ${base}*.svg`);
59
- console.log(`\tbuilding GIFs...`);
60
- execSync(`gm convert -delay 6 ${base}*.png ${base}.gif`);
61
- execSync(
62
- `gm convert -delay 6 -resize 200x200 ${base}*.png ${base}-small.gif`
63
- );
64
- console.log(`\tbuilding MP4...`);
65
- execSync(
66
- `ffmpeg -r 30 -i ${base}-%03d.png -c:v libx264 -pix_fmt yuv420p -y ${base}.mp4`
67
- );
68
- });