pattapatta 0.3.0 → 0.4.0
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 +6 -0
- package/dist/{circle-BDbKfrdR.d.ts → circle-CauDMv8V.d.ts} +1 -1
- package/dist/circlePacking/index.d.ts +2 -3
- package/dist/construction/index.d.ts +11 -3
- package/dist/construction/index.js +429 -2
- package/dist/construction/index.js.map +1 -1
- package/dist/contour/index.d.ts +3 -4
- package/dist/contour/index.js.map +1 -1
- package/dist/conversion/index.d.ts +2 -3
- package/dist/{group-BNjVVYSQ.d.ts → group-YVmSJuGo.d.ts} +1 -1
- package/dist/hatch/index.d.ts +70 -4
- package/dist/hatch/index.js +414 -3
- package/dist/hatch/index.js.map +1 -1
- package/dist/hull/index.d.ts +1 -2
- package/dist/index.d.ts +12 -13
- package/dist/index.js +1816 -1260
- package/dist/index.js.map +1 -1
- package/dist/meshing/index.d.ts +3 -4
- package/dist/morphology/index.d.ts +2 -3
- package/dist/optimisation/index.d.ts +2 -3
- package/dist/{path-0RjhYjJs.d.ts → path-Boeshk9L.d.ts} +9 -2
- package/dist/pointSet/index.d.ts +15 -2
- package/dist/pointSet/index.js +148 -2
- package/dist/pointSet/index.js.map +1 -1
- package/dist/polygonisation/index.d.ts +1 -2
- package/dist/polygonisation/index.js +54 -50
- package/dist/polygonisation/index.js.map +1 -1
- package/dist/predicates/index.d.ts +2 -3
- package/dist/processing/index.d.ts +3 -4
- package/dist/{segment-BKuIFMKD.d.ts → segment-CpLILSd7.d.ts} +1 -1
- package/dist/segmentSet/index.d.ts +41 -3
- package/dist/segmentSet/index.js +261 -1
- package/dist/segmentSet/index.js.map +1 -1
- package/dist/shapeBoolean/index.d.ts +2 -3
- package/dist/svg/index.d.ts +2 -3
- package/dist/tiling/index.d.ts +10 -4
- package/dist/tiling/index.js +148 -13
- package/dist/tiling/index.js.map +1 -1
- package/dist/transformation/index.d.ts +1 -2
- package/dist/triangulation/index.d.ts +1 -2
- package/dist/triangulation/index.js.map +1 -1
- package/dist/voronoi/index.d.ts +2 -3
- package/package.json +1 -1
- package/dist/vec2-CWyXN1Wj.d.ts +0 -10
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as Vec2 } from '../
|
|
2
|
-
import { S as Segment } from '../segment-
|
|
1
|
+
import { P as Path, V as Vec2 } from '../path-Boeshk9L.js';
|
|
2
|
+
import { S as Segment } from '../segment-CpLILSd7.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Parallel segments through a center point (PGS `parallelSegments` semantics).
|
|
@@ -7,6 +7,41 @@ import { S as Segment } from '../segment-BKuIFMKD.js';
|
|
|
7
7
|
* `angle` is radians along the segment; spacing is perpendicular.
|
|
8
8
|
*/
|
|
9
9
|
declare function parallelSegments(centerX: number, centerY: number, length: number, spacing: number, angle: number, n: number): Segment[];
|
|
10
|
+
/**
|
|
11
|
+
* Random non-intersecting segments in a box anchored at `(originX, originY)`
|
|
12
|
+
* with the given width/height (PGS `stochasticSegments`).
|
|
13
|
+
*
|
|
14
|
+
* Lengths are uniform in `[minLength, maxLength)` when the range differs;
|
|
15
|
+
* use equal min/max for fixed length. Seeded via mulberry32.
|
|
16
|
+
*/
|
|
17
|
+
declare function stochasticSegments(width: number, height: number, n: number, minLength?: number, maxLength?: number, seed?: number, originX?: number, originY?: number): Segment[];
|
|
18
|
+
/**
|
|
19
|
+
* Fabric-like horizontal/vertical weave on a regular cell grid
|
|
20
|
+
* (PGS `weaveSegments` / ABC auxetics).
|
|
21
|
+
*
|
|
22
|
+
* Domain is `[originX, originX+width] × [originY, originY+height]`.
|
|
23
|
+
* A/B control weft/warp run lengths; C is the row phase shift (mod A+B).
|
|
24
|
+
*/
|
|
25
|
+
declare function weaveSegments(width: number, height: number, cellSize: number, A?: number, B?: number, C?: number, options?: WeaveSegmentsOptions): Segment[];
|
|
26
|
+
type WeaveSegmentsOptions = {
|
|
27
|
+
originX?: number;
|
|
28
|
+
originY?: number;
|
|
29
|
+
/** Swap weft/warp roles. */
|
|
30
|
+
swapColors?: boolean;
|
|
31
|
+
/** Endpoint position inside run end cells (0.5..1 typical). Default `1`. */
|
|
32
|
+
cellFraction?: number;
|
|
33
|
+
/** Extend single-cell boundary runs to the grid edge. Default `true`. */
|
|
34
|
+
extendSingletonsToEdge?: boolean;
|
|
35
|
+
};
|
|
36
|
+
/** Per-sample length for {@link perpendicularPathSegments}. */
|
|
37
|
+
type SegmentLengthFn = (x: number, y: number, posFrac: number, normalAngle: number) => number;
|
|
38
|
+
/**
|
|
39
|
+
* Perpendicular ticks along each ring of `path`, centered on the boundary
|
|
40
|
+
* (PGS `perpendicularPathSegments`). Outline texture, not an area fill.
|
|
41
|
+
*
|
|
42
|
+
* Closed rings are oriented CW so the left-hand normal points outward.
|
|
43
|
+
*/
|
|
44
|
+
declare function perpendicularPathSegments(path: Path, interSegmentDistance: number, length: number | SegmentLengthFn, startOffset?: number): Segment[];
|
|
10
45
|
declare function filterByMinLength(segments: Segment[], minLength: number): Segment[];
|
|
11
46
|
declare function filterAxisAligned(segments: Segment[], angleDelta: number): Segment[];
|
|
12
47
|
declare function segmentLength(s: Segment): number;
|
|
@@ -16,10 +51,13 @@ declare function segmentsToOpenPaths(segments: Segment[]): {
|
|
|
16
51
|
}[];
|
|
17
52
|
declare const segmentSet: {
|
|
18
53
|
parallelSegments: typeof parallelSegments;
|
|
54
|
+
stochasticSegments: typeof stochasticSegments;
|
|
55
|
+
weaveSegments: typeof weaveSegments;
|
|
56
|
+
perpendicularPathSegments: typeof perpendicularPathSegments;
|
|
19
57
|
filterByMinLength: typeof filterByMinLength;
|
|
20
58
|
filterAxisAligned: typeof filterAxisAligned;
|
|
21
59
|
segmentLength: typeof segmentLength;
|
|
22
60
|
segmentsToOpenPaths: typeof segmentsToOpenPaths;
|
|
23
61
|
};
|
|
24
62
|
|
|
25
|
-
export { Vec2, filterAxisAligned, filterByMinLength, parallelSegments, segmentLength, segmentSet, segmentsToOpenPaths };
|
|
63
|
+
export { type SegmentLengthFn, Vec2, type WeaveSegmentsOptions, filterAxisAligned, filterByMinLength, parallelSegments, perpendicularPathSegments, segmentLength, segmentSet, segmentsToOpenPaths, stochasticSegments, weaveSegments };
|
package/dist/segmentSet/index.js
CHANGED
|
@@ -73,6 +73,193 @@ function parallelSegments(centerX, centerY, length, spacing, angle, n) {
|
|
|
73
73
|
}
|
|
74
74
|
return edges;
|
|
75
75
|
}
|
|
76
|
+
function stochasticSegments(width, height, n, minLength, maxLength, seed = 1, originX = 0, originY = 0) {
|
|
77
|
+
const minL = minLength ?? 1;
|
|
78
|
+
const maxL = maxLength ?? Math.min(width, height);
|
|
79
|
+
if (n < 1 || width <= 0 || height <= 0) return [];
|
|
80
|
+
const monoLength = minL === maxL;
|
|
81
|
+
const rng = mulberry32(seed >>> 0);
|
|
82
|
+
const edges = [];
|
|
83
|
+
const maxAttempts = Math.max(1e4, n * 500);
|
|
84
|
+
let attempts = 0;
|
|
85
|
+
while (edges.length < n && attempts < maxAttempts) {
|
|
86
|
+
attempts++;
|
|
87
|
+
const length = monoLength ? minL : minL + rng() * (maxL - minL);
|
|
88
|
+
if (!(length > 0) || length * 2 >= width || length * 2 >= height) {
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
const ax = originX + rng() * (width - length * 2) + length;
|
|
92
|
+
const ay = originY + rng() * (height - length * 2) + length;
|
|
93
|
+
const theta = rng() * Math.PI * 2;
|
|
94
|
+
const bx = ax + Math.cos(theta) * length;
|
|
95
|
+
const by = ay + Math.sin(theta) * length;
|
|
96
|
+
const a = vec2(ax, ay);
|
|
97
|
+
const b = vec2(bx, by);
|
|
98
|
+
let hits = false;
|
|
99
|
+
for (const s of edges) {
|
|
100
|
+
if (segmentsIntersect(a, b, s.a, s.b)) {
|
|
101
|
+
hits = true;
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (!hits) edges.push(segment(a, b));
|
|
106
|
+
}
|
|
107
|
+
return edges;
|
|
108
|
+
}
|
|
109
|
+
function weaveSegments(width, height, cellSize, A = 1, B = 1, C = 1, options = {}) {
|
|
110
|
+
if (!(cellSize > 0)) {
|
|
111
|
+
throw new Error("weaveSegments: cellSize must be > 0");
|
|
112
|
+
}
|
|
113
|
+
if (A <= 0 || B <= 0) {
|
|
114
|
+
throw new Error("weaveSegments: A and B must be > 0");
|
|
115
|
+
}
|
|
116
|
+
const {
|
|
117
|
+
originX = 0,
|
|
118
|
+
originY = 0,
|
|
119
|
+
swapColors = false,
|
|
120
|
+
cellFraction = 1,
|
|
121
|
+
extendSingletonsToEdge = true
|
|
122
|
+
} = options;
|
|
123
|
+
if (!(cellFraction > 0)) {
|
|
124
|
+
throw new Error("weaveSegments: cellFraction must be > 0");
|
|
125
|
+
}
|
|
126
|
+
const P = A + B;
|
|
127
|
+
const f = Math.max(0, Math.min(1, cellFraction));
|
|
128
|
+
const cols = Math.max(1, Math.floor(width / cellSize));
|
|
129
|
+
const rows = Math.max(1, Math.floor(height / cellSize));
|
|
130
|
+
const gridW = cols * cellSize;
|
|
131
|
+
const gridH = rows * cellSize;
|
|
132
|
+
const dx = originX + (width - gridW) * 0.5;
|
|
133
|
+
const dy = originY + (height - gridH) * 0.5;
|
|
134
|
+
const gridLeft = dx;
|
|
135
|
+
const gridRight = dx + gridW;
|
|
136
|
+
const gridBottom = dy;
|
|
137
|
+
const gridTop = dy + gridH;
|
|
138
|
+
const weft = Array.from(
|
|
139
|
+
{ length: rows },
|
|
140
|
+
() => Array.from({ length: cols }, () => false)
|
|
141
|
+
);
|
|
142
|
+
for (let r = 0; r < rows; r++) {
|
|
143
|
+
const shift = floorMod(r * C, P);
|
|
144
|
+
for (let c = 0; c < cols; c++) {
|
|
145
|
+
const idx = floorMod(c + shift, P);
|
|
146
|
+
let isWeft = idx < A;
|
|
147
|
+
if (swapColors) isWeft = !isWeft;
|
|
148
|
+
weft[r][c] = isWeft;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
const segs = [];
|
|
152
|
+
for (let r = 0; r < rows; r++) {
|
|
153
|
+
let c = 0;
|
|
154
|
+
while (c < cols) {
|
|
155
|
+
if (!weft[r][c]) {
|
|
156
|
+
c++;
|
|
157
|
+
continue;
|
|
158
|
+
}
|
|
159
|
+
const start = c;
|
|
160
|
+
while (c + 1 < cols && weft[r][c + 1]) c++;
|
|
161
|
+
const end = c;
|
|
162
|
+
const runLen = end - start + 1;
|
|
163
|
+
const y = dy + (r + 0.5) * cellSize;
|
|
164
|
+
let x0 = dx + (start + (1 - f)) * cellSize;
|
|
165
|
+
let x1 = dx + (end + f) * cellSize;
|
|
166
|
+
if (extendSingletonsToEdge && runLen === 1) {
|
|
167
|
+
const cx = dx + (start + 0.5) * cellSize;
|
|
168
|
+
if (start === 0) {
|
|
169
|
+
x0 = gridLeft;
|
|
170
|
+
x1 = cx;
|
|
171
|
+
} else if (end === cols - 1) {
|
|
172
|
+
x0 = cx;
|
|
173
|
+
x1 = gridRight;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
x0 = clamp(x0, gridLeft, gridRight);
|
|
177
|
+
x1 = clamp(x1, gridLeft, gridRight);
|
|
178
|
+
segs.push(segment(vec2(x0, y), vec2(x1, y)));
|
|
179
|
+
c++;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
for (let c = 0; c < cols; c++) {
|
|
183
|
+
let r = 0;
|
|
184
|
+
while (r < rows) {
|
|
185
|
+
if (weft[r][c]) {
|
|
186
|
+
r++;
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
const start = r;
|
|
190
|
+
while (r + 1 < rows && !weft[r + 1][c]) r++;
|
|
191
|
+
const end = r;
|
|
192
|
+
const runLen = end - start + 1;
|
|
193
|
+
const x = dx + (c + 0.5) * cellSize;
|
|
194
|
+
let y0 = dy + (start + (1 - f)) * cellSize;
|
|
195
|
+
let y1 = dy + (end + f) * cellSize;
|
|
196
|
+
if (extendSingletonsToEdge && runLen === 1) {
|
|
197
|
+
const cy = dy + (start + 0.5) * cellSize;
|
|
198
|
+
if (start === 0) {
|
|
199
|
+
y0 = gridBottom;
|
|
200
|
+
y1 = cy;
|
|
201
|
+
} else if (end === rows - 1) {
|
|
202
|
+
y0 = cy;
|
|
203
|
+
y1 = gridTop;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
y0 = clamp(y0, gridBottom, gridTop);
|
|
207
|
+
y1 = clamp(y1, gridBottom, gridTop);
|
|
208
|
+
segs.push(segment(vec2(x, y0), vec2(x, y1)));
|
|
209
|
+
r++;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return segs;
|
|
213
|
+
}
|
|
214
|
+
function perpendicularPathSegments(path, interSegmentDistance, length, startOffset = 0) {
|
|
215
|
+
if (!(interSegmentDistance > 0)) return [];
|
|
216
|
+
const lengthFn = typeof length === "function" ? length : () => length;
|
|
217
|
+
const startNorm = (startOffset % 1 + 1) % 1;
|
|
218
|
+
const edges = [];
|
|
219
|
+
for (const ring of path.rings) {
|
|
220
|
+
if (ring.length < 2) continue;
|
|
221
|
+
const closed = path.closed;
|
|
222
|
+
let pts = ring.map((v) => vec2(v.x, v.y));
|
|
223
|
+
if (closed && shoelace(pts) > 0) {
|
|
224
|
+
pts = pts.slice().reverse();
|
|
225
|
+
}
|
|
226
|
+
const indexed = lengthIndex(pts, closed);
|
|
227
|
+
const end = indexed.total;
|
|
228
|
+
if (!(end > 0)) continue;
|
|
229
|
+
const count = Math.max(1, Math.round(end / interSegmentDistance));
|
|
230
|
+
const increment = 1 / count;
|
|
231
|
+
const eps = Math.max(
|
|
232
|
+
end * 1e-4,
|
|
233
|
+
Math.min(interSegmentDistance * 0.35, end * 0.01)
|
|
234
|
+
);
|
|
235
|
+
for (let i = 0; i < count; i++) {
|
|
236
|
+
const posFrac = (startNorm + i * increment) % 1;
|
|
237
|
+
const idx = posFrac * end;
|
|
238
|
+
const idxM = closed ? wrapIndex(idx - eps, end) : clamp(idx - eps, 0, end);
|
|
239
|
+
const idxP = closed ? wrapIndex(idx + eps, end) : clamp(idx + eps, 0, end);
|
|
240
|
+
const pm = indexed.pointAt(idxM);
|
|
241
|
+
const pp = indexed.pointAt(idxP);
|
|
242
|
+
const pc = indexed.pointAt(idx);
|
|
243
|
+
const tx = pp.x - pm.x;
|
|
244
|
+
const ty = pp.y - pm.y;
|
|
245
|
+
const tlen = Math.hypot(tx, ty);
|
|
246
|
+
if (tlen === 0) continue;
|
|
247
|
+
const nx = -ty / tlen;
|
|
248
|
+
const ny = tx / tlen;
|
|
249
|
+
const normalAngle = Math.atan2(ny, nx);
|
|
250
|
+
const L = lengthFn(pc.x, pc.y, posFrac, normalAngle);
|
|
251
|
+
if (!(L > 0)) continue;
|
|
252
|
+
const half = L * 0.5;
|
|
253
|
+
edges.push(
|
|
254
|
+
segment(
|
|
255
|
+
vec2(pc.x - nx * half, pc.y - ny * half),
|
|
256
|
+
vec2(pc.x + nx * half, pc.y + ny * half)
|
|
257
|
+
)
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
return edges;
|
|
262
|
+
}
|
|
76
263
|
function filterByMinLength(segments, minLength) {
|
|
77
264
|
return segments.filter((s) => segmentLength(s) >= minLength);
|
|
78
265
|
}
|
|
@@ -98,12 +285,85 @@ function segmentsToOpenPaths(segments) {
|
|
|
98
285
|
}
|
|
99
286
|
var segmentSet = {
|
|
100
287
|
parallelSegments,
|
|
288
|
+
stochasticSegments,
|
|
289
|
+
weaveSegments,
|
|
290
|
+
perpendicularPathSegments,
|
|
101
291
|
filterByMinLength,
|
|
102
292
|
filterAxisAligned,
|
|
103
293
|
segmentLength,
|
|
104
294
|
segmentsToOpenPaths
|
|
105
295
|
};
|
|
296
|
+
function floorMod(n, m) {
|
|
297
|
+
return (n % m + m) % m;
|
|
298
|
+
}
|
|
299
|
+
function clamp(v, lo, hi) {
|
|
300
|
+
return Math.max(lo, Math.min(hi, v));
|
|
301
|
+
}
|
|
302
|
+
function wrapIndex(idx, end) {
|
|
303
|
+
if (end <= 0) return 0;
|
|
304
|
+
let x = idx % end;
|
|
305
|
+
if (x < 0) x += end;
|
|
306
|
+
return x;
|
|
307
|
+
}
|
|
308
|
+
function shoelace(ring) {
|
|
309
|
+
let sum = 0;
|
|
310
|
+
for (let i = 0; i < ring.length; i++) {
|
|
311
|
+
const a = ring[i];
|
|
312
|
+
const b = ring[(i + 1) % ring.length];
|
|
313
|
+
sum += a.x * b.y - b.x * a.y;
|
|
314
|
+
}
|
|
315
|
+
return sum / 2;
|
|
316
|
+
}
|
|
317
|
+
function segmentsIntersect(a, b, c, d) {
|
|
318
|
+
return ccw(a, c, d) !== ccw(b, c, d) && ccw(a, b, c) !== ccw(a, b, d);
|
|
319
|
+
}
|
|
320
|
+
function ccw(a, b, c) {
|
|
321
|
+
return (c.y - a.y) * (b.x - a.x) > (b.y - a.y) * (c.x - a.x);
|
|
322
|
+
}
|
|
323
|
+
function mulberry32(seed) {
|
|
324
|
+
return function() {
|
|
325
|
+
let t = seed += 1831565813;
|
|
326
|
+
t = Math.imul(t ^ t >>> 15, t | 1);
|
|
327
|
+
t ^= t + Math.imul(t ^ t >>> 7, t | 61);
|
|
328
|
+
return ((t ^ t >>> 14) >>> 0) / 4294967296;
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
function lengthIndex(ring, closed) {
|
|
332
|
+
const n = ring.length;
|
|
333
|
+
const edgeCount = closed ? n : n - 1;
|
|
334
|
+
const lengths = [];
|
|
335
|
+
let total = 0;
|
|
336
|
+
for (let i = 0; i < edgeCount; i++) {
|
|
337
|
+
const a = ring[i];
|
|
338
|
+
const b = ring[(i + 1) % n];
|
|
339
|
+
const L = Math.hypot(b.x - a.x, b.y - a.y);
|
|
340
|
+
lengths.push(L);
|
|
341
|
+
total += L;
|
|
342
|
+
}
|
|
343
|
+
return {
|
|
344
|
+
total,
|
|
345
|
+
pointAt(dist) {
|
|
346
|
+
let remain = dist;
|
|
347
|
+
if (remain <= 0) return { ...ring[0] };
|
|
348
|
+
if (remain >= total) return { ...ring[closed ? 0 : n - 1] };
|
|
349
|
+
for (let i = 0; i < lengths.length; i++) {
|
|
350
|
+
const L = lengths[i];
|
|
351
|
+
if (remain <= L || i === lengths.length - 1) {
|
|
352
|
+
const t = L < 1e-12 ? 0 : remain / L;
|
|
353
|
+
const a = ring[i];
|
|
354
|
+
const b = ring[(i + 1) % n];
|
|
355
|
+
return {
|
|
356
|
+
x: a.x + (b.x - a.x) * t,
|
|
357
|
+
y: a.y + (b.y - a.y) * t
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
remain -= L;
|
|
361
|
+
}
|
|
362
|
+
return { ...ring[0] };
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
}
|
|
106
366
|
|
|
107
|
-
export { filterAxisAligned, filterByMinLength, parallelSegments, segmentLength, segmentSet, segmentsToOpenPaths };
|
|
367
|
+
export { filterAxisAligned, filterByMinLength, parallelSegments, perpendicularPathSegments, segmentLength, segmentSet, segmentsToOpenPaths, stochasticSegments, weaveSegments };
|
|
108
368
|
//# sourceMappingURL=index.js.map
|
|
109
369
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/types/vec2.ts","../../src/types/segment.ts","../../src/segmentSet/index.ts"],"names":[],"mappings":";AAMO,SAAS,IAAA,CAAK,GAAW,CAAA,EAAiB;AAC/C,EAAA,OAAO,EAAE,GAAG,CAAA,EAAE;AAChB;;;ACAO,SAAS,OAAA,CAAQ,GAAS,CAAA,EAAkB;AACjD,EAAA,OAAO,EAAE,GAAG,CAAA,EAAE;AAChB;;;ACNA,SAAS,IAAI,CAAA,EAAmB;AAC9B,EAAA,OAAO,IAAA,CAAK,OAAO,CAAC,CAAA;AACtB;AAOO,SAAS,iBACd,OAAA,EACA,OAAA,EACA,MAAA,EACA,OAAA,EACA,OACA,CAAA,EACW;AACX,EAAA,MAAM,QAAmB,EAAC;AAC1B,EAAA,IAAI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,IAAA,CAAK,IAAI,IAAA,GAAO,IAAA,CAAK,EAAE,CAAA,IAAK,UAAA;AAChE,IAAA,MAAM,QAAQ,IAAA,CAAK,GAAA,CAAI,OAAO,IAAA,CAAK,EAAA,GAAK,CAAC,CAAA,IAAK,UAAA;AAC9C,IAAA,OAAO,EAAE,KAAA,IAAS,KAAA,CAAA;AAAA,EACpB,CAAC,CAAA;AACH;AAEO,SAAS,cAAc,CAAA,EAAoB;AAChD,EAAA,MAAM,EAAA,GAAK,CAAA,CAAE,CAAA,CAAE,CAAA,GAAI,EAAE,CAAA,CAAE,CAAA;AACvB,EAAA,MAAM,EAAA,GAAK,CAAA,CAAE,CAAA,CAAE,CAAA,GAAI,EAAE,CAAA,CAAE,CAAA;AACvB,EAAA,OAAO,IAAA,CAAK,KAAA,CAAM,EAAA,EAAI,EAAE,CAAA;AAC1B;AAEO,SAAS,oBAAoB,QAAA,EAAqB;AACvD,EAAA,OAAO,QAAA,CAAS,GAAA,CAAI,CAAC,CAAA,MAAO;AAAA,IAC1B,OAAO,CAAC,CAAC,EAAE,CAAA,EAAG,CAAA,CAAE,CAAC,CAAC,CAAA;AAAA,IAClB,MAAA,EAAQ;AAAA,GACV,CAAE,CAAA;AACJ;AAEO,IAAM,UAAA,GAAa;AAAA,EACxB,gBAAA;AAAA,EACA,iBAAA;AAAA,EACA,iBAAA;AAAA,EACA,aAAA;AAAA,EACA;AACF","file":"index.js","sourcesContent":["/** 2D point / vector. */\nexport type Vec2 = {\n x: number\n y: number\n}\n\nexport function vec2(x: number, y: number): Vec2 {\n return { x, y }\n}\n\nexport function cloneVec2(v: Vec2): Vec2 {\n return { x: v.x, y: v.y }\n}\n\nexport function equalsVec2(a: Vec2, b: Vec2, eps = 1e-9): boolean {\n return Math.abs(a.x - b.x) <= eps && Math.abs(a.y - b.y) <= eps\n}\n","import type { Vec2 } from './vec2.js'\n\n/** Line segment between two points. */\nexport type Segment = {\n a: Vec2\n b: Vec2\n}\n\nexport function segment(a: Vec2, b: Vec2): Segment {\n return { a, b }\n}\n","import type { Segment, Vec2 } from '../types/index.js'\nimport { segment, vec2 } from '../types/index.js'\n\n/** Match Processing `float` for PGS parity on hatch fixtures. */\nfunction f32(n: number): number {\n return Math.fround(n)\n}\n\n/**\n * Parallel segments through a center point (PGS `parallelSegments` semantics).\n * `length` is the half-length along the segment direction; full span is `2 * length`.\n * `angle` is radians along the segment; spacing is perpendicular.\n */\nexport function parallelSegments(\n centerX: number,\n centerY: number,\n length: number,\n spacing: number,\n angle: number,\n n: number,\n): Segment[] {\n const edges: Segment[] = []\n if (n < 1) return edges\n\n const center = vec2(f32(centerX), f32(centerY))\n let dx = f32(Math.cos(angle + Math.PI / 2) * spacing)\n let dy = f32(Math.sin(angle + Math.PI / 2) * spacing)\n const cos = f32(Math.cos(angle))\n const sin = f32(Math.sin(angle))\n const l = f32(length)\n\n let i: number\n let offX = 0\n let offY = 0\n\n if (n % 2 === 1) {\n const a = vec2(f32(center.x + cos * l), f32(center.y + sin * l))\n const b = vec2(f32(center.x + cos * -l), f32(center.y + sin * -l))\n edges.push(segment(a, b))\n i = 1\n } else {\n dx = f32(dx / 2)\n dy = f32(dy / 2)\n i = 1\n {\n let a = vec2(f32(center.x + dx * i), f32(center.y + dy * i))\n const b = vec2(f32(a.x + cos * l), f32(a.y + sin * l))\n a = vec2(f32(a.x + cos * -l), f32(a.y + sin * -l))\n edges.push(segment(a, b))\n }\n {\n let a = vec2(f32(center.x + dx * -i), f32(center.y + dy * -i))\n const b = vec2(f32(a.x + cos * l), f32(a.y + sin * l))\n a = vec2(f32(a.x + cos * -l), f32(a.y + sin * -l))\n edges.push(segment(a, b))\n }\n i = 2\n dx = f32(dx * 2)\n dy = f32(dy * 2)\n offX = f32(dx / 2)\n offY = f32(dy / 2)\n }\n\n for (; i < 1 + Math.floor(n / 2); i++) {\n {\n let a = vec2(\n f32(center.x + dx * i - offX),\n f32(center.y + dy * i - offY),\n )\n const b = vec2(f32(a.x + cos * l), f32(a.y + sin * l))\n a = vec2(f32(a.x + cos * -l), f32(a.y + sin * -l))\n edges.push(segment(a, b))\n }\n {\n let a = vec2(\n f32(center.x + dx * -i + offX),\n f32(center.y + dy * -i + offY),\n )\n const b = vec2(f32(a.x + cos * l), f32(a.y + sin * l))\n a = vec2(f32(a.x + cos * -l), f32(a.y + sin * -l))\n edges.push(segment(a, b))\n }\n }\n\n return edges\n}\n\nexport function filterByMinLength(\n segments: Segment[],\n minLength: number,\n): Segment[] {\n return segments.filter((s) => segmentLength(s) >= minLength)\n}\n\nexport function filterAxisAligned(\n segments: Segment[],\n angleDelta: number,\n): Segment[] {\n return segments.filter((s) => {\n const ang = Math.abs(Math.atan2(s.b.y - s.a.y, s.b.x - s.a.x))\n const norm = Math.min(ang % Math.PI, Math.PI - (ang % Math.PI))\n const nearH = norm <= angleDelta || Math.abs(norm - Math.PI) <= angleDelta\n const nearV = Math.abs(norm - Math.PI / 2) <= angleDelta\n return !(nearH || nearV)\n })\n}\n\nexport function segmentLength(s: Segment): number {\n const dx = s.b.x - s.a.x\n const dy = s.b.y - s.a.y\n return Math.hypot(dx, dy)\n}\n\nexport function segmentsToOpenPaths(segments: Segment[]) {\n return segments.map((s) => ({\n rings: [[s.a, s.b]],\n closed: false as const,\n }))\n}\n\nexport const segmentSet = {\n parallelSegments,\n filterByMinLength,\n filterAxisAligned,\n segmentLength,\n segmentsToOpenPaths,\n}\n\nexport type { Vec2 }\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/types/vec2.ts","../../src/types/segment.ts","../../src/segmentSet/index.ts"],"names":[],"mappings":";AAMO,SAAS,IAAA,CAAK,GAAW,CAAA,EAAiB;AAC/C,EAAA,OAAO,EAAE,GAAG,CAAA,EAAE;AAChB;;;ACAO,SAAS,OAAA,CAAQ,GAAS,CAAA,EAAkB;AACjD,EAAA,OAAO,EAAE,GAAG,CAAA,EAAE;AAChB;;;ACNA,SAAS,IAAI,CAAA,EAAmB;AAC9B,EAAA,OAAO,IAAA,CAAK,OAAO,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2 = {\n x: number\n y: number\n}\n\nexport function vec2(x: number, y: number): Vec2 {\n return { x, y }\n}\n\nexport function cloneVec2(v: Vec2): Vec2 {\n return { x: v.x, y: v.y }\n}\n\nexport function equalsVec2(a: Vec2, b: Vec2, eps = 1e-9): boolean {\n return Math.abs(a.x - b.x) <= eps && Math.abs(a.y - b.y) <= eps\n}\n","import type { Vec2 } from './vec2.js'\n\n/** Line segment between two points. */\nexport type Segment = {\n a: Vec2\n b: Vec2\n}\n\nexport function segment(a: Vec2, b: Vec2): Segment {\n return { a, b }\n}\n","import type { Path, Segment, Vec2 } from '../types/index.js'\nimport { segment, vec2 } from '../types/index.js'\n\n/** Match Processing `float` for PGS parity on hatch fixtures. */\nfunction f32(n: number): number {\n return Math.fround(n)\n}\n\n/**\n * Parallel segments through a center point (PGS `parallelSegments` semantics).\n * `length` is the half-length along the segment direction; full span is `2 * length`.\n * `angle` is radians along the segment; spacing is perpendicular.\n */\nexport function parallelSegments(\n centerX: number,\n centerY: number,\n length: number,\n spacing: number,\n angle: number,\n n: number,\n): Segment[] {\n const edges: Segment[] = []\n if (n < 1) return edges\n\n const center = vec2(f32(centerX), f32(centerY))\n let dx = f32(Math.cos(angle + Math.PI / 2) * spacing)\n let dy = f32(Math.sin(angle + Math.PI / 2) * spacing)\n const cos = f32(Math.cos(angle))\n const sin = f32(Math.sin(angle))\n const l = f32(length)\n\n let i: number\n let offX = 0\n let offY = 0\n\n if (n % 2 === 1) {\n const a = vec2(f32(center.x + cos * l), f32(center.y + sin * l))\n const b = vec2(f32(center.x + cos * -l), f32(center.y + sin * -l))\n edges.push(segment(a, b))\n i = 1\n } else {\n dx = f32(dx / 2)\n dy = f32(dy / 2)\n i = 1\n {\n let a = vec2(f32(center.x + dx * i), f32(center.y + dy * i))\n const b = vec2(f32(a.x + cos * l), f32(a.y + sin * l))\n a = vec2(f32(a.x + cos * -l), f32(a.y + sin * -l))\n edges.push(segment(a, b))\n }\n {\n let a = vec2(f32(center.x + dx * -i), f32(center.y + dy * -i))\n const b = vec2(f32(a.x + cos * l), f32(a.y + sin * l))\n a = vec2(f32(a.x + cos * -l), f32(a.y + sin * -l))\n edges.push(segment(a, b))\n }\n i = 2\n dx = f32(dx * 2)\n dy = f32(dy * 2)\n offX = f32(dx / 2)\n offY = f32(dy / 2)\n }\n\n for (; i < 1 + Math.floor(n / 2); i++) {\n {\n let a = vec2(\n f32(center.x + dx * i - offX),\n f32(center.y + dy * i - offY),\n )\n const b = vec2(f32(a.x + cos * l), f32(a.y + sin * l))\n a = vec2(f32(a.x + cos * -l), f32(a.y + sin * -l))\n edges.push(segment(a, b))\n }\n {\n let a = vec2(\n f32(center.x + dx * -i + offX),\n f32(center.y + dy * -i + offY),\n )\n const b = vec2(f32(a.x + cos * l), f32(a.y + sin * l))\n a = vec2(f32(a.x + cos * -l), f32(a.y + sin * -l))\n edges.push(segment(a, b))\n }\n }\n\n return edges\n}\n\n/**\n * Random non-intersecting segments in a box anchored at `(originX, originY)`\n * with the given width/height (PGS `stochasticSegments`).\n *\n * Lengths are uniform in `[minLength, maxLength)` when the range differs;\n * use equal min/max for fixed length. Seeded via mulberry32.\n */\nexport function stochasticSegments(\n width: number,\n height: number,\n n: number,\n minLength?: number,\n maxLength?: number,\n seed = 1,\n originX = 0,\n originY = 0,\n): Segment[] {\n const minL =\n minLength ?? 1\n const maxL =\n maxLength ?? Math.min(width, height)\n if (n < 1 || width <= 0 || height <= 0) return []\n\n const monoLength = minL === maxL\n const rng = mulberry32(seed >>> 0)\n const edges: Segment[] = []\n const maxAttempts = Math.max(10_000, n * 500)\n let attempts = 0\n\n while (edges.length < n && attempts < maxAttempts) {\n attempts++\n const length = monoLength ? minL : minL + rng() * (maxL - minL)\n if (!(length > 0) || length * 2 >= width || length * 2 >= height) {\n continue\n }\n const ax = originX + rng() * (width - length * 2) + length\n const ay = originY + rng() * (height - length * 2) + length\n const theta = rng() * Math.PI * 2\n const bx = ax + Math.cos(theta) * length\n const by = ay + Math.sin(theta) * length\n const a = vec2(ax, ay)\n const b = vec2(bx, by)\n\n let hits = false\n for (const s of edges) {\n if (segmentsIntersect(a, b, s.a, s.b)) {\n hits = true\n break\n }\n }\n if (!hits) edges.push(segment(a, b))\n }\n\n return edges\n}\n\n/**\n * Fabric-like horizontal/vertical weave on a regular cell grid\n * (PGS `weaveSegments` / ABC auxetics).\n *\n * Domain is `[originX, originX+width] × [originY, originY+height]`.\n * A/B control weft/warp run lengths; C is the row phase shift (mod A+B).\n */\nexport function weaveSegments(\n width: number,\n height: number,\n cellSize: number,\n A = 1,\n B = 1,\n C = 1,\n options: WeaveSegmentsOptions = {},\n): Segment[] {\n if (!(cellSize > 0)) {\n throw new Error('weaveSegments: cellSize must be > 0')\n }\n if (A <= 0 || B <= 0) {\n throw new Error('weaveSegments: A and B must be > 0')\n }\n\n const {\n originX = 0,\n originY = 0,\n swapColors = false,\n cellFraction = 1,\n extendSingletonsToEdge = true,\n } = options\n\n if (!(cellFraction > 0)) {\n throw new Error('weaveSegments: cellFraction must be > 0')\n }\n\n const P = A + B\n const f = Math.max(0, Math.min(1, cellFraction))\n\n const cols = Math.max(1, Math.floor(width / cellSize))\n const rows = Math.max(1, Math.floor(height / cellSize))\n const gridW = cols * cellSize\n const gridH = rows * cellSize\n const dx = originX + (width - gridW) * 0.5\n const dy = originY + (height - gridH) * 0.5\n\n const gridLeft = dx\n const gridRight = dx + gridW\n const gridBottom = dy\n const gridTop = dy + gridH\n\n const weft: boolean[][] = Array.from({ length: rows }, () =>\n Array.from({ length: cols }, () => false),\n )\n for (let r = 0; r < rows; r++) {\n const shift = floorMod(r * C, P)\n for (let c = 0; c < cols; c++) {\n const idx = floorMod(c + shift, P)\n let isWeft = idx < A\n if (swapColors) isWeft = !isWeft\n weft[r]![c] = isWeft\n }\n }\n\n const segs: Segment[] = []\n\n for (let r = 0; r < rows; r++) {\n let c = 0\n while (c < cols) {\n if (!weft[r]![c]) {\n c++\n continue\n }\n const start = c\n while (c + 1 < cols && weft[r]![c + 1]) c++\n const end = c\n const runLen = end - start + 1\n const y = dy + (r + 0.5) * cellSize\n let x0 = dx + (start + (1 - f)) * cellSize\n let x1 = dx + (end + f) * cellSize\n\n if (extendSingletonsToEdge && runLen === 1) {\n const cx = dx + (start + 0.5) * cellSize\n if (start === 0) {\n x0 = gridLeft\n x1 = cx\n } else if (end === cols - 1) {\n x0 = cx\n x1 = gridRight\n }\n }\n\n x0 = clamp(x0, gridLeft, gridRight)\n x1 = clamp(x1, gridLeft, gridRight)\n segs.push(segment(vec2(x0, y), vec2(x1, y)))\n c++\n }\n }\n\n for (let c = 0; c < cols; c++) {\n let r = 0\n while (r < rows) {\n if (weft[r]![c]) {\n r++\n continue\n }\n const start = r\n while (r + 1 < rows && !weft[r + 1]![c]) r++\n const end = r\n const runLen = end - start + 1\n const x = dx + (c + 0.5) * cellSize\n let y0 = dy + (start + (1 - f)) * cellSize\n let y1 = dy + (end + f) * cellSize\n\n if (extendSingletonsToEdge && runLen === 1) {\n const cy = dy + (start + 0.5) * cellSize\n if (start === 0) {\n y0 = gridBottom\n y1 = cy\n } else if (end === rows - 1) {\n y0 = cy\n y1 = gridTop\n }\n }\n\n y0 = clamp(y0, gridBottom, gridTop)\n y1 = clamp(y1, gridBottom, gridTop)\n segs.push(segment(vec2(x, y0), vec2(x, y1)))\n r++\n }\n }\n\n return segs\n}\n\nexport type WeaveSegmentsOptions = {\n originX?: number\n originY?: number\n /** Swap weft/warp roles. */\n swapColors?: boolean\n /** Endpoint position inside run end cells (0.5..1 typical). Default `1`. */\n cellFraction?: number\n /** Extend single-cell boundary runs to the grid edge. Default `true`. */\n extendSingletonsToEdge?: boolean\n}\n\n/** Per-sample length for {@link perpendicularPathSegments}. */\nexport type SegmentLengthFn = (\n x: number,\n y: number,\n posFrac: number,\n normalAngle: number,\n) => number\n\n/**\n * Perpendicular ticks along each ring of `path`, centered on the boundary\n * (PGS `perpendicularPathSegments`). Outline texture, not an area fill.\n *\n * Closed rings are oriented CW so the left-hand normal points outward.\n */\nexport function perpendicularPathSegments(\n path: Path,\n interSegmentDistance: number,\n length: number | SegmentLengthFn,\n startOffset = 0,\n): Segment[] {\n if (!(interSegmentDistance > 0)) return []\n const lengthFn: SegmentLengthFn =\n typeof length === 'function' ? length : () => length\n\n const startNorm = ((startOffset % 1) + 1) % 1\n const edges: Segment[] = []\n\n for (const ring of path.rings) {\n if (ring.length < 2) continue\n const closed = path.closed\n let pts = ring.map((v) => vec2(v.x, v.y))\n if (closed && shoelace(pts) > 0) {\n pts = pts.slice().reverse()\n }\n\n const indexed = lengthIndex(pts, closed)\n const end = indexed.total\n if (!(end > 0)) continue\n\n const count = Math.max(1, Math.round(end / interSegmentDistance))\n const increment = 1 / count\n const eps = Math.max(\n end * 1e-4,\n Math.min(interSegmentDistance * 0.35, end * 0.01),\n )\n\n for (let i = 0; i < count; i++) {\n const posFrac = (startNorm + i * increment) % 1\n const idx = posFrac * end\n const idxM = closed\n ? wrapIndex(idx - eps, end)\n : clamp(idx - eps, 0, end)\n const idxP = closed\n ? wrapIndex(idx + eps, end)\n : clamp(idx + eps, 0, end)\n\n const pm = indexed.pointAt(idxM)\n const pp = indexed.pointAt(idxP)\n const pc = indexed.pointAt(idx)\n\n const tx = pp.x - pm.x\n const ty = pp.y - pm.y\n const tlen = Math.hypot(tx, ty)\n if (tlen === 0) continue\n\n const nx = -ty / tlen\n const ny = tx / tlen\n const normalAngle = Math.atan2(ny, nx)\n const L = lengthFn(pc.x, pc.y, posFrac, normalAngle)\n if (!(L > 0)) continue\n const half = L * 0.5\n edges.push(\n segment(\n vec2(pc.x - nx * half, pc.y - ny * half),\n vec2(pc.x + nx * half, pc.y + ny * half),\n ),\n )\n }\n }\n\n return edges\n}\n\nexport function filterByMinLength(\n segments: Segment[],\n minLength: number,\n): Segment[] {\n return segments.filter((s) => segmentLength(s) >= minLength)\n}\n\nexport function filterAxisAligned(\n segments: Segment[],\n angleDelta: number,\n): Segment[] {\n return segments.filter((s) => {\n const ang = Math.abs(Math.atan2(s.b.y - s.a.y, s.b.x - s.a.x))\n const norm = Math.min(ang % Math.PI, Math.PI - (ang % Math.PI))\n const nearH = norm <= angleDelta || Math.abs(norm - Math.PI) <= angleDelta\n const nearV = Math.abs(norm - Math.PI / 2) <= angleDelta\n return !(nearH || nearV)\n })\n}\n\nexport function segmentLength(s: Segment): number {\n const dx = s.b.x - s.a.x\n const dy = s.b.y - s.a.y\n return Math.hypot(dx, dy)\n}\n\nexport function segmentsToOpenPaths(segments: Segment[]) {\n return segments.map((s) => ({\n rings: [[s.a, s.b]],\n closed: false as const,\n }))\n}\n\nexport const segmentSet = {\n parallelSegments,\n stochasticSegments,\n weaveSegments,\n perpendicularPathSegments,\n filterByMinLength,\n filterAxisAligned,\n segmentLength,\n segmentsToOpenPaths,\n}\n\nfunction floorMod(n: number, m: number): number {\n return ((n % m) + m) % m\n}\n\nfunction clamp(v: number, lo: number, hi: number): number {\n return Math.max(lo, Math.min(hi, v))\n}\n\nfunction wrapIndex(idx: number, end: number): number {\n if (end <= 0) return 0\n let x = idx % end\n if (x < 0) x += end\n return x\n}\n\nfunction shoelace(ring: Vec2[]): number {\n let sum = 0\n for (let i = 0; i < ring.length; i++) {\n const a = ring[i]!\n const b = ring[(i + 1) % ring.length]!\n sum += a.x * b.y - b.x * a.y\n }\n return sum / 2\n}\n\n/** Proper segment intersection (shared endpoint counts as intersect). */\nfunction segmentsIntersect(a: Vec2, b: Vec2, c: Vec2, d: Vec2): boolean {\n return (\n ccw(a, c, d) !== ccw(b, c, d) && ccw(a, b, c) !== ccw(a, b, d)\n )\n}\n\nfunction ccw(a: Vec2, b: Vec2, c: Vec2): boolean {\n return (c.y - a.y) * (b.x - a.x) > (b.y - a.y) * (c.x - a.x)\n}\n\nfunction mulberry32(seed: number): () => number {\n return function () {\n let t = (seed += 0x6d2b79f5)\n t = Math.imul(t ^ (t >>> 15), t | 1)\n t ^= t + Math.imul(t ^ (t >>> 7), t | 61)\n return ((t ^ (t >>> 14)) >>> 0) / 4294967296\n }\n}\n\nfunction lengthIndex(ring: Vec2[], closed: boolean) {\n const n = ring.length\n const edgeCount = closed ? n : n - 1\n const lengths: number[] = []\n let total = 0\n for (let i = 0; i < edgeCount; i++) {\n const a = ring[i]!\n const b = ring[(i + 1) % n]!\n const L = Math.hypot(b.x - a.x, b.y - a.y)\n lengths.push(L)\n total += L\n }\n return {\n total,\n pointAt(dist: number): Vec2 {\n let remain = dist\n if (remain <= 0) return { ...ring[0]! }\n if (remain >= total) return { ...ring[closed ? 0 : n - 1]! }\n for (let i = 0; i < lengths.length; i++) {\n const L = lengths[i]!\n if (remain <= L || i === lengths.length - 1) {\n const t = L < 1e-12 ? 0 : remain / L\n const a = ring[i]!\n const b = ring[(i + 1) % n]!\n return {\n x: a.x + (b.x - a.x) * t,\n y: a.y + (b.y - a.y) * t,\n }\n }\n remain -= L\n }\n return { ...ring[0]! }\n },\n }\n}\n\nexport type { Vec2 }\n"]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { P as Path } from '../path-
|
|
2
|
-
import { G as Group } from '../group-
|
|
3
|
-
import '../vec2-CWyXN1Wj.js';
|
|
1
|
+
import { P as Path } from '../path-Boeshk9L.js';
|
|
2
|
+
import { G as Group } from '../group-YVmSJuGo.js';
|
|
4
3
|
|
|
5
4
|
/** Union of two closed paths. */
|
|
6
5
|
declare function union(a: Path, b: Path): Group;
|
package/dist/svg/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { G as Group } from '../group-
|
|
2
|
-
import { R as Ring } from '../path-
|
|
3
|
-
import '../vec2-CWyXN1Wj.js';
|
|
1
|
+
import { G as Group } from '../group-YVmSJuGo.js';
|
|
2
|
+
import { R as Ring } from '../path-Boeshk9L.js';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* Parse a subset of SVG into a geometry group.
|
package/dist/tiling/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { P as Path } from '../path-
|
|
2
|
-
import { G as Group } from '../group-
|
|
3
|
-
import '../vec2-CWyXN1Wj.js';
|
|
1
|
+
import { P as Path } from '../path-Boeshk9L.js';
|
|
2
|
+
import { G as Group } from '../group-YVmSJuGo.js';
|
|
4
3
|
|
|
5
4
|
/** Axis-aligned square cells covering a box. */
|
|
6
5
|
declare function squareGrid(spacing: number, minX: number, minY: number, maxX: number, maxY: number): Group;
|
|
@@ -19,6 +18,12 @@ declare function triangleSubdivision(faces: Path[], depth?: number): Group;
|
|
|
19
18
|
declare function sliceDivision(p: Path, spacing: number, angle?: number): Group;
|
|
20
19
|
/** Parallel hatch-like strip division (alias of sliceDivision). */
|
|
21
20
|
declare function hatchSubdivision(p: Path, spacing: number, angle?: number): Group;
|
|
21
|
+
/**
|
|
22
|
+
* Cellular partition of a rectangle using arcs from circles seeded on the
|
|
23
|
+
* boundary (PGS `arcDivision`). Each circle radius is large enough to hit at
|
|
24
|
+
* least two distinct sides.
|
|
25
|
+
*/
|
|
26
|
+
declare function arcDivision(width: number, height: number, arcs: number, seed?: number, circlePoints?: number): Group;
|
|
22
27
|
declare const tiling: {
|
|
23
28
|
squareGrid: typeof squareGrid;
|
|
24
29
|
hexTiling: typeof hexTiling;
|
|
@@ -27,6 +32,7 @@ declare const tiling: {
|
|
|
27
32
|
triangleSubdivision: typeof triangleSubdivision;
|
|
28
33
|
sliceDivision: typeof sliceDivision;
|
|
29
34
|
hatchSubdivision: typeof hatchSubdivision;
|
|
35
|
+
arcDivision: typeof arcDivision;
|
|
30
36
|
};
|
|
31
37
|
|
|
32
|
-
export { hatchSubdivision, hexTiling, quadSubdivision, rectSubdivision, sliceDivision, squareGrid, tiling, triangleSubdivision };
|
|
38
|
+
export { arcDivision, hatchSubdivision, hexTiling, quadSubdivision, rectSubdivision, sliceDivision, squareGrid, tiling, triangleSubdivision };
|