@thi.ng/geom-sdf 0.2.25 → 0.2.27
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 +7 -10
- package/api.d.ts +3 -3
- package/as-sdf.d.ts +8 -4
- package/as-sdf.js +8 -4
- package/package.json +20 -20
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<!-- This file is generated - DO NOT EDIT! -->
|
|
2
2
|
|
|
3
|
-
# 
|
|
3
|
+
# 
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@thi.ng/geom-sdf)
|
|
6
6
|

|
|
7
|
-
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
This project is part of the
|
|
10
10
|
[@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo.
|
|
@@ -23,7 +23,7 @@ This project is part of the
|
|
|
23
23
|
|
|
24
24
|
## About
|
|
25
25
|
|
|
26
|
-
2D Signed Distance Field creation from
|
|
26
|
+
2D Signed Distance Field creation from @thi.ng/geom shapes, conversions, sampling, combinators
|
|
27
27
|
|
|
28
28
|
Includes several distance functions and SDF operators ported from GLSL
|
|
29
29
|
implementations by:
|
|
@@ -129,11 +129,8 @@ ES module import:
|
|
|
129
129
|
|
|
130
130
|
For Node.js REPL:
|
|
131
131
|
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
node --experimental-repl-await
|
|
135
|
-
|
|
136
|
-
> const geomSdf = await import("@thi.ng/geom-sdf");
|
|
132
|
+
```js
|
|
133
|
+
const geomSdf = await import("@thi.ng/geom-sdf");
|
|
137
134
|
```
|
|
138
135
|
|
|
139
136
|
Package sizes (brotli'd, pre-treeshake): ESM: 3.52 KB
|
|
@@ -226,7 +223,7 @@ Results:
|
|
|
226
223
|
|
|
227
224
|
## Authors
|
|
228
225
|
|
|
229
|
-
Karsten Schmidt
|
|
226
|
+
- [Karsten Schmidt](https://thi.ng)
|
|
230
227
|
|
|
231
228
|
If this project contributes to an academic publication, please cite it as:
|
|
232
229
|
|
|
@@ -241,4 +238,4 @@ If this project contributes to an academic publication, please cite it as:
|
|
|
241
238
|
|
|
242
239
|
## License
|
|
243
240
|
|
|
244
|
-
© 2022 Karsten Schmidt // Apache
|
|
241
|
+
© 2022 Karsten Schmidt // Apache License 2.0
|
package/api.d.ts
CHANGED
|
@@ -5,9 +5,9 @@ import type { ReadonlyVec } from "@thi.ng/vectors";
|
|
|
5
5
|
* optionally taking into account an already computed `minD` min distance (e.g.
|
|
6
6
|
* used for bounding hierarchies). `minD` defaults to positive ∞.
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
8
|
+
export type SDFn = (p: ReadonlyVec, minD?: number) => number;
|
|
9
|
+
export type SDFCombineOp = "union" | "isec" | "diff";
|
|
10
|
+
export type FieldCoeff<T = number> = Fn<ReadonlyVec, T>;
|
|
11
11
|
/**
|
|
12
12
|
* Options object to customize geometry -> SDF conversions. Given as value to
|
|
13
13
|
* the special `__sdf` shape attribute.
|
package/as-sdf.d.ts
CHANGED
|
@@ -2,8 +2,11 @@ import type { MultiFn1 } from "@thi.ng/defmulti";
|
|
|
2
2
|
import type { IShape } from "@thi.ng/geom-api";
|
|
3
3
|
import type { SDFn } from "./api.js";
|
|
4
4
|
/**
|
|
5
|
-
* Takes an
|
|
6
|
-
*
|
|
5
|
+
* Takes an
|
|
6
|
+
* [`IShape`](https://docs.thi.ng/umbrella/geom-api/interfaces/IShape.html)
|
|
7
|
+
* instance (possibly a tree, e.g. via
|
|
8
|
+
* [`group()`](https://docs.thi.ng/umbrella/geom/functions/group.html)) and
|
|
9
|
+
* converts it into a {@link SDFn}.
|
|
7
10
|
*
|
|
8
11
|
* @remarks
|
|
9
12
|
* Currently supported shape types:
|
|
@@ -22,9 +25,10 @@ import type { SDFn } from "./api.js";
|
|
|
22
25
|
*
|
|
23
26
|
* For shapes which need to be converted to polygons/polylines, the
|
|
24
27
|
* {@link SDFAttribs.samples} attribute can be used to control the resulting
|
|
25
|
-
* number of vertices. If not specified
|
|
28
|
+
* number of vertices. If not specified
|
|
29
|
+
* [`DEFAULT_SAMPLES`](https://docs.thi.ng/umbrella/geom-api/variables/DEFAULT_SAMPLES.html)
|
|
26
30
|
* will be used (which can be globally set via
|
|
27
|
-
*
|
|
31
|
+
* [`setDefaultSamples()`](https://docs.thi.ng/umbrella/geom-api/functions/setDefaultSamples.html)).
|
|
28
32
|
*/
|
|
29
33
|
export declare const asSDF: MultiFn1<IShape, SDFn>;
|
|
30
34
|
//# sourceMappingURL=as-sdf.d.ts.map
|
package/as-sdf.js
CHANGED
|
@@ -10,8 +10,11 @@ import { mulN2 } from "@thi.ng/vectors/muln";
|
|
|
10
10
|
import { chamferDiff, chamferIsec, chamferUnion, diff, isec, roundDiff, roundIsec, roundUnion, smoothDiff, smoothIsec, smoothUnion, stepDiff, stepIsec, stepUnion, union, } from "./ops.js";
|
|
11
11
|
import { box2, circle2, DEFAULT_ATTRIBS, ellipse2, line2, points2, polygon2, polyline2, quadratic2, withSDFAttribs, } from "./shapes.js";
|
|
12
12
|
/**
|
|
13
|
-
* Takes an
|
|
14
|
-
*
|
|
13
|
+
* Takes an
|
|
14
|
+
* [`IShape`](https://docs.thi.ng/umbrella/geom-api/interfaces/IShape.html)
|
|
15
|
+
* instance (possibly a tree, e.g. via
|
|
16
|
+
* [`group()`](https://docs.thi.ng/umbrella/geom/functions/group.html)) and
|
|
17
|
+
* converts it into a {@link SDFn}.
|
|
15
18
|
*
|
|
16
19
|
* @remarks
|
|
17
20
|
* Currently supported shape types:
|
|
@@ -30,9 +33,10 @@ import { box2, circle2, DEFAULT_ATTRIBS, ellipse2, line2, points2, polygon2, pol
|
|
|
30
33
|
*
|
|
31
34
|
* For shapes which need to be converted to polygons/polylines, the
|
|
32
35
|
* {@link SDFAttribs.samples} attribute can be used to control the resulting
|
|
33
|
-
* number of vertices. If not specified
|
|
36
|
+
* number of vertices. If not specified
|
|
37
|
+
* [`DEFAULT_SAMPLES`](https://docs.thi.ng/umbrella/geom-api/variables/DEFAULT_SAMPLES.html)
|
|
34
38
|
* will be used (which can be globally set via
|
|
35
|
-
*
|
|
39
|
+
* [`setDefaultSamples()`](https://docs.thi.ng/umbrella/geom-api/functions/setDefaultSamples.html)).
|
|
36
40
|
*/
|
|
37
41
|
export const asSDF = defmulti(__dispatch, {
|
|
38
42
|
quad: "poly",
|
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.27",
|
|
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",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "https://github.com/thi-ng/umbrella.git"
|
|
12
12
|
},
|
|
13
|
-
"homepage": "https://github.com/thi-ng/umbrella/tree/
|
|
13
|
+
"homepage": "https://github.com/thi-ng/umbrella/tree/develop/packages/geom-sdf#readme",
|
|
14
14
|
"funding": [
|
|
15
15
|
{
|
|
16
16
|
"type": "github",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"url": "https://patreon.com/thing_umbrella"
|
|
22
22
|
}
|
|
23
23
|
],
|
|
24
|
-
"author": "Karsten Schmidt
|
|
24
|
+
"author": "Karsten Schmidt (https://thi.ng)",
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
26
|
"scripts": {
|
|
27
27
|
"build": "yarn clean && tsc --declaration",
|
|
@@ -34,26 +34,26 @@
|
|
|
34
34
|
"test": "testament test"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@thi.ng/api": "^8.
|
|
38
|
-
"@thi.ng/checks": "^3.3.
|
|
39
|
-
"@thi.ng/defmulti": "^2.1.
|
|
40
|
-
"@thi.ng/errors": "^2.2.
|
|
41
|
-
"@thi.ng/geom": "^4.0.
|
|
42
|
-
"@thi.ng/geom-api": "^3.3.
|
|
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.6.1",
|
|
38
|
+
"@thi.ng/checks": "^3.3.5",
|
|
39
|
+
"@thi.ng/defmulti": "^2.1.25",
|
|
40
|
+
"@thi.ng/errors": "^2.2.6",
|
|
41
|
+
"@thi.ng/geom": "^4.0.2",
|
|
42
|
+
"@thi.ng/geom-api": "^3.3.22",
|
|
43
|
+
"@thi.ng/geom-isoline": "^2.1.36",
|
|
44
|
+
"@thi.ng/geom-poly-utils": "^2.3.23",
|
|
45
|
+
"@thi.ng/geom-resample": "^2.1.40",
|
|
46
|
+
"@thi.ng/math": "^5.3.17",
|
|
47
|
+
"@thi.ng/transducers": "^8.3.27",
|
|
48
|
+
"@thi.ng/vectors": "^7.5.28"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@microsoft/api-extractor": "^7.33.
|
|
52
|
-
"@thi.ng/testament": "^0.3.
|
|
51
|
+
"@microsoft/api-extractor": "^7.33.7",
|
|
52
|
+
"@thi.ng/testament": "^0.3.7",
|
|
53
53
|
"rimraf": "^3.0.2",
|
|
54
54
|
"tools": "^0.0.1",
|
|
55
|
-
"typedoc": "^0.23.
|
|
56
|
-
"typescript": "^4.
|
|
55
|
+
"typedoc": "^0.23.22",
|
|
56
|
+
"typescript": "^4.9.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": "7b2af448da8a63fb21704a79cc4cdf1f3d7d7a64\n"
|
|
131
131
|
}
|