@thi.ng/geom-trace-bitmap 0.3.165 → 0.3.167
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/README.md +2 -2
- package/package.json +8 -8
- package/trace.js +3 -3
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
> [!NOTE]
|
|
10
|
-
> This is one of
|
|
10
|
+
> This is one of 211 standalone projects, maintained as part
|
|
11
11
|
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
|
|
12
12
|
> and anti-framework.
|
|
13
13
|
>
|
|
@@ -77,7 +77,7 @@ For Node.js REPL:
|
|
|
77
77
|
const gtb = await import("@thi.ng/geom-trace-bitmap");
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
-
Package sizes (brotli'd, pre-treeshake): ESM:
|
|
80
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 996 bytes
|
|
81
81
|
|
|
82
82
|
## Dependencies
|
|
83
83
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/geom-trace-bitmap",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.167",
|
|
4
4
|
"description": "Bitmap image to hairline vector and point cloud conversions",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@thi.ng/api": "^8.12.
|
|
43
|
-
"@thi.ng/errors": "^2.5.
|
|
44
|
-
"@thi.ng/grid-iterators": "^4.0.
|
|
45
|
-
"@thi.ng/matrices": "^3.0.
|
|
46
|
-
"@thi.ng/pixel": "^7.5.
|
|
47
|
-
"@thi.ng/vectors": "^8.6.
|
|
42
|
+
"@thi.ng/api": "^8.12.10",
|
|
43
|
+
"@thi.ng/errors": "^2.5.50",
|
|
44
|
+
"@thi.ng/grid-iterators": "^4.0.145",
|
|
45
|
+
"@thi.ng/matrices": "^3.0.31",
|
|
46
|
+
"@thi.ng/pixel": "^7.5.19",
|
|
47
|
+
"@thi.ng/vectors": "^8.6.16"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"esbuild": "^0.27.0",
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
"status": "alpha",
|
|
103
103
|
"year": 2022
|
|
104
104
|
},
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "8625a1c6383737a8fdbe7a3f96ea3cbabc957fa6\n"
|
|
106
106
|
}
|
package/trace.js
CHANGED
|
@@ -10,7 +10,7 @@ const traceBitmap = (opts) => {
|
|
|
10
10
|
const { width, height } = opts.img;
|
|
11
11
|
const lines = [];
|
|
12
12
|
const points = [];
|
|
13
|
-
for (
|
|
13
|
+
for (const d of opts.dir || ["h", "v", "d1", "d2", "p"]) {
|
|
14
14
|
if (typeof d !== "string") {
|
|
15
15
|
traceLines(
|
|
16
16
|
opts,
|
|
@@ -75,9 +75,9 @@ const traceLines = (opts, order, border, tx, acc = []) => {
|
|
|
75
75
|
let prevBorder = false;
|
|
76
76
|
const $record = () => {
|
|
77
77
|
acc.push([curr[0], curr[curr.length - 1]]);
|
|
78
|
-
for (
|
|
78
|
+
for (const q of curr) img.setAtUnsafe(q[0], q[1], clear);
|
|
79
79
|
};
|
|
80
|
-
for (
|
|
80
|
+
for (const p of order({ cols: img.width, rows: img.height, tx })) {
|
|
81
81
|
const c = select(img.getAtUnsafe(p[0], p[1]), p);
|
|
82
82
|
const isBorder = border(p);
|
|
83
83
|
const n = curr.length;
|