@thi.ng/geom-axidraw 0.1.0 → 0.1.1
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 +42 -45
- package/api.d.ts +2 -2
- package/package.json +19 -19
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-axidraw)
|
|
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.
|
|
@@ -16,7 +16,7 @@ This project is part of the
|
|
|
16
16
|
- [Draw order](#draw-order)
|
|
17
17
|
- [Basic usage & examples](#basic-usage--examples)
|
|
18
18
|
- [Interpolated polygons](#interpolated-polygons)
|
|
19
|
-
|
|
19
|
+
- [Clipping](#clipping)
|
|
20
20
|
- [Status](#status)
|
|
21
21
|
- [Related packages](#related-packages)
|
|
22
22
|
- [Installation](#installation)
|
|
@@ -27,7 +27,7 @@ This project is part of the
|
|
|
27
27
|
|
|
28
28
|
## About
|
|
29
29
|
|
|
30
|
-
Conversion and preparation of thi.ng/geom shapes & shape groups to AxiDraw pen plotter draw commands
|
|
30
|
+
Conversion and preparation of thi.ng/geom shapes & shape groups to AxiDraw pen plotter draw commands
|
|
31
31
|
|
|
32
32
|
This package only deals with the conversion aspects. The
|
|
33
33
|
[@thi.ng/axidraw](https://github.com/thi-ng/umbrella/blob/develop/packages/axidraw)
|
|
@@ -132,30 +132,30 @@ import { asAxiDraw } from "@thi.ng/geom-axidraw";
|
|
|
132
132
|
import { map, range } from "@thi.ng/transducers";
|
|
133
133
|
|
|
134
134
|
(async () => {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
135
|
+
// create group of bezier-interpolated star polygons,
|
|
136
|
+
// with each path using a slightly different configuration
|
|
137
|
+
const geo = group({ translate: [100, 100] }, [
|
|
138
|
+
...map(
|
|
139
|
+
(t) =>
|
|
140
|
+
pathFromCubics(
|
|
141
|
+
asCubic(star(90, 6, [t, 1]), {
|
|
142
|
+
breakPoints: true,
|
|
143
|
+
scale: 0.66,
|
|
144
|
+
})
|
|
145
|
+
),
|
|
146
|
+
range(0.3, 1.01, 0.05)
|
|
147
|
+
),
|
|
148
|
+
]);
|
|
149
|
+
|
|
150
|
+
// connect to plotter
|
|
151
|
+
const axi = new AxiDraw();
|
|
152
|
+
await axi.connect();
|
|
153
|
+
// convert geometry to drawing commands & send to plotter
|
|
154
|
+
await axi.draw(asAxiDraw(geo, { samples: 40 }));
|
|
155
155
|
})();
|
|
156
156
|
```
|
|
157
157
|
|
|
158
|
-
|
|
158
|
+
#### Clipping
|
|
159
159
|
|
|
160
160
|
(Result: https://mastodon.thi.ng/@toxi/109483553358349473)
|
|
161
161
|
|
|
@@ -166,19 +166,19 @@ import { asAxiDraw } from "@thi.ng/geom-axidraw";
|
|
|
166
166
|
import { map, range } from "@thi.ng/transducers";
|
|
167
167
|
|
|
168
168
|
(async () => {
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
169
|
+
const origin = [100, 100];
|
|
170
|
+
const radius = 50;
|
|
171
|
+
const boundary = starWithCentroid(origin, radius, 5, [1, 0.45], { __axi: { speed: 0.25 } });
|
|
172
|
+
// group of concentric circles using boundary as clip polygon
|
|
173
|
+
const geo = group({}, [
|
|
174
|
+
boundary,
|
|
175
|
+
group({ __samples: 40, __axi: { clip: vertices(boundary) } }, [
|
|
176
|
+
...map((r) => circle(origin, r), range(2, radius, 2)),
|
|
177
|
+
]),
|
|
178
|
+
]);
|
|
179
|
+
const axi = new AxiDraw();
|
|
180
|
+
await axi.connect();
|
|
181
|
+
await axi.draw(asAxiDraw(geo));
|
|
182
182
|
})();
|
|
183
183
|
```
|
|
184
184
|
|
|
@@ -208,11 +208,8 @@ ES module import:
|
|
|
208
208
|
|
|
209
209
|
For Node.js REPL:
|
|
210
210
|
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
node --experimental-repl-await
|
|
214
|
-
|
|
215
|
-
> const geomAxidraw = await import("@thi.ng/geom-axidraw");
|
|
211
|
+
```js
|
|
212
|
+
const geomAxidraw = await import("@thi.ng/geom-axidraw");
|
|
216
213
|
```
|
|
217
214
|
|
|
218
215
|
Package sizes (brotli'd, pre-treeshake): ESM: 856 bytes
|
|
@@ -239,7 +236,7 @@ TODO
|
|
|
239
236
|
|
|
240
237
|
## Authors
|
|
241
238
|
|
|
242
|
-
Karsten Schmidt
|
|
239
|
+
- [Karsten Schmidt](https://thi.ng)
|
|
243
240
|
|
|
244
241
|
If this project contributes to an academic publication, please cite it as:
|
|
245
242
|
|
|
@@ -254,4 +251,4 @@ If this project contributes to an academic publication, please cite it as:
|
|
|
254
251
|
|
|
255
252
|
## License
|
|
256
253
|
|
|
257
|
-
© 2022 Karsten Schmidt // Apache
|
|
254
|
+
© 2022 Karsten Schmidt // Apache License 2.0
|
package/api.d.ts
CHANGED
|
@@ -70,6 +70,6 @@ export interface AsAxiDrawOpts {
|
|
|
70
70
|
*/
|
|
71
71
|
clip: ReadonlyVec[];
|
|
72
72
|
}
|
|
73
|
-
export
|
|
74
|
-
export
|
|
73
|
+
export type PointOrdering = Fn<ReadonlyVec[], Iterable<ReadonlyVec>>;
|
|
74
|
+
export type ShapeOrdering = Fn<IShape[], Iterable<IShape>>;
|
|
75
75
|
//# sourceMappingURL=api.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/geom-axidraw",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Conversion and preparation of thi.ng/geom shapes & shape groups to AxiDraw pen plotter draw commands",
|
|
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-axidraw#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,25 +34,25 @@
|
|
|
34
34
|
"test": "testament test"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@thi.ng/api": "^8.
|
|
38
|
-
"@thi.ng/arrays": "^2.4.
|
|
39
|
-
"@thi.ng/axidraw": "^0.2.
|
|
40
|
-
"@thi.ng/compare": "^2.1.
|
|
41
|
-
"@thi.ng/defmulti": "^2.1.
|
|
42
|
-
"@thi.ng/geom": "^4.0.
|
|
43
|
-
"@thi.ng/geom-accel": "^3.2.
|
|
44
|
-
"@thi.ng/geom-api": "^3.3.
|
|
45
|
-
"@thi.ng/geom-clip-line": "^2.2.
|
|
46
|
-
"@thi.ng/geom-isec": "^2.1.
|
|
47
|
-
"@thi.ng/vectors": "^7.5.
|
|
37
|
+
"@thi.ng/api": "^8.6.0",
|
|
38
|
+
"@thi.ng/arrays": "^2.4.5",
|
|
39
|
+
"@thi.ng/axidraw": "^0.2.1",
|
|
40
|
+
"@thi.ng/compare": "^2.1.19",
|
|
41
|
+
"@thi.ng/defmulti": "^2.1.24",
|
|
42
|
+
"@thi.ng/geom": "^4.0.1",
|
|
43
|
+
"@thi.ng/geom-accel": "^3.2.29",
|
|
44
|
+
"@thi.ng/geom-api": "^3.3.21",
|
|
45
|
+
"@thi.ng/geom-clip-line": "^2.2.1",
|
|
46
|
+
"@thi.ng/geom-isec": "^2.1.38",
|
|
47
|
+
"@thi.ng/vectors": "^7.5.27"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@microsoft/api-extractor": "^7.33.
|
|
51
|
-
"@thi.ng/testament": "^0.3.
|
|
50
|
+
"@microsoft/api-extractor": "^7.33.7",
|
|
51
|
+
"@thi.ng/testament": "^0.3.7",
|
|
52
52
|
"rimraf": "^3.0.2",
|
|
53
53
|
"tools": "^0.0.1",
|
|
54
|
-
"typedoc": "^0.23.
|
|
55
|
-
"typescript": "^4.
|
|
54
|
+
"typedoc": "^0.23.22",
|
|
55
|
+
"typescript": "^4.9.4"
|
|
56
56
|
},
|
|
57
57
|
"keywords": [
|
|
58
58
|
"2d",
|
|
@@ -117,5 +117,5 @@
|
|
|
117
117
|
"status": "alpha",
|
|
118
118
|
"year": 2022
|
|
119
119
|
},
|
|
120
|
-
"gitHead": "
|
|
120
|
+
"gitHead": "f445a9cc8022bcdebbf6ff91fd66ced016d72f01\n"
|
|
121
121
|
}
|