@thi.ng/geom-sdf 0.2.0 → 0.2.3
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 +1 -1
- package/README.md +4 -5
- package/package.json +16 -16
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -158,7 +158,7 @@ Package sizes (gzipped, pre-treeshake): ESM: 3.87 KB
|
|
|
158
158
|
[Generated API docs](https://docs.thi.ng/umbrella/geom-sdf/)
|
|
159
159
|
|
|
160
160
|
```js
|
|
161
|
-
import { asSvg, bounds, circle, group,
|
|
161
|
+
import { asSvg, bounds, circle, group, svgDoc } from "@thi.ng/geom";
|
|
162
162
|
import { asPolygons, asSDF, sample2d } from "@thi.ng/geom-sdf";
|
|
163
163
|
import { range, repeatedly } from "@thi.ng/transducers";
|
|
164
164
|
import { randMinMax2 } from "@thi.ng/vectors";
|
|
@@ -196,11 +196,10 @@ const image = sample2d(sdf, sceneBounds, RES);
|
|
|
196
196
|
|
|
197
197
|
// extract contour polygons from given image
|
|
198
198
|
// in this case the contours extracted are at distances in the [0..32) interval
|
|
199
|
-
//
|
|
199
|
+
// the function also simplifies the resulting polygons using the Douglas-Peucker algorithm
|
|
200
|
+
// with the given threshold (0.25) - the default setting only removes co-linear vertices...
|
|
200
201
|
// see: https://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm
|
|
201
|
-
const contours = asPolygons(image, sceneBounds, RES, range(0, 32, 4))
|
|
202
|
-
(p) => simplify(p, 0.25)
|
|
203
|
-
);
|
|
202
|
+
const contours = asPolygons(image, sceneBounds, RES, range(0, 32, 4), 0.25);
|
|
204
203
|
|
|
205
204
|
// convert to SVG and output as file
|
|
206
205
|
writeFileSync(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/geom-sdf",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "2D Signed Distance Field creation from @thi.ng/geom shapes, conversions, sampling, combinators",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -34,26 +34,26 @@
|
|
|
34
34
|
"test": "testament test"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@thi.ng/api": "^8.3.
|
|
38
|
-
"@thi.ng/checks": "^3.2.
|
|
39
|
-
"@thi.ng/defmulti": "^2.1.
|
|
40
|
-
"@thi.ng/errors": "^2.1.
|
|
41
|
-
"@thi.ng/geom": "^3.
|
|
42
|
-
"@thi.ng/geom-api": "^3.2
|
|
43
|
-
"@thi.ng/geom-isoline": "^2.1.
|
|
44
|
-
"@thi.ng/geom-poly-utils": "^2.3.
|
|
45
|
-
"@thi.ng/geom-resample": "^2.1.
|
|
46
|
-
"@thi.ng/math": "^5.3.
|
|
47
|
-
"@thi.ng/transducers": "^8.3.
|
|
48
|
-
"@thi.ng/vectors": "^7.5.
|
|
37
|
+
"@thi.ng/api": "^8.3.8",
|
|
38
|
+
"@thi.ng/checks": "^3.2.2",
|
|
39
|
+
"@thi.ng/defmulti": "^2.1.8",
|
|
40
|
+
"@thi.ng/errors": "^2.1.8",
|
|
41
|
+
"@thi.ng/geom": "^3.4.2",
|
|
42
|
+
"@thi.ng/geom-api": "^3.3.2",
|
|
43
|
+
"@thi.ng/geom-isoline": "^2.1.16",
|
|
44
|
+
"@thi.ng/geom-poly-utils": "^2.3.3",
|
|
45
|
+
"@thi.ng/geom-resample": "^2.1.19",
|
|
46
|
+
"@thi.ng/math": "^5.3.4",
|
|
47
|
+
"@thi.ng/transducers": "^8.3.7",
|
|
48
|
+
"@thi.ng/vectors": "^7.5.8"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@microsoft/api-extractor": "^7.25.0",
|
|
52
|
-
"@thi.ng/testament": "^0.2.
|
|
52
|
+
"@thi.ng/testament": "^0.2.9",
|
|
53
53
|
"rimraf": "^3.0.2",
|
|
54
54
|
"tools": "^0.0.1",
|
|
55
55
|
"typedoc": "^0.22.17",
|
|
56
|
-
"typescript": "^4.7.
|
|
56
|
+
"typescript": "^4.7.4"
|
|
57
57
|
},
|
|
58
58
|
"keywords": [
|
|
59
59
|
"2d",
|
|
@@ -127,5 +127,5 @@
|
|
|
127
127
|
"status": "alpha",
|
|
128
128
|
"year": 2022
|
|
129
129
|
},
|
|
130
|
-
"gitHead": "
|
|
130
|
+
"gitHead": "108a6357b77d457912d30681d7cc5603ae995209\n"
|
|
131
131
|
}
|