@gridspace/raster-path 1.0.7 → 1.0.8
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/build/app.js +36 -0
- package/build/index.html +3 -0
- package/build/raster-path.js +7 -2
- package/build/raster-worker.js +533 -2
- package/package.json +3 -2
- package/src/core/path-radial-v3.js +405 -0
- package/src/core/raster-config.js +24 -0
- package/src/core/raster-path.js +7 -2
- package/src/core/raster-worker.js +10 -0
- package/src/shaders/radial-rasterize-batched.wgsl +164 -0
- package/src/shaders/radial-rotate-triangles.wgsl +70 -0
- package/src/test/radial-v3-benchmark.cjs +184 -0
- package/src/test/radial-v3-bucket-test.cjs +154 -0
- package/src/web/app.js +36 -0
- package/src/web/index.html +3 -0
package/build/app.js
CHANGED
|
@@ -71,6 +71,12 @@ function saveParameters() {
|
|
|
71
71
|
if (showWrappedCheckbox) {
|
|
72
72
|
localStorage.setItem('raster-showWrapped', showWrappedCheckbox.checked);
|
|
73
73
|
}
|
|
74
|
+
|
|
75
|
+
// Save radial V3 checkbox
|
|
76
|
+
const radialV3Checkbox = document.getElementById('radial-v3');
|
|
77
|
+
if (radialV3Checkbox) {
|
|
78
|
+
localStorage.setItem('raster-radialV3', radialV3Checkbox.checked);
|
|
79
|
+
}
|
|
74
80
|
}
|
|
75
81
|
|
|
76
82
|
function loadParameters() {
|
|
@@ -153,6 +159,15 @@ function loadParameters() {
|
|
|
153
159
|
showWrappedCheckbox.checked = savedShowWrapped === 'true';
|
|
154
160
|
}
|
|
155
161
|
}
|
|
162
|
+
|
|
163
|
+
// Restore radial V3 checkbox
|
|
164
|
+
const savedRadialV3 = localStorage.getItem('raster-radialV3');
|
|
165
|
+
if (savedRadialV3 !== null) {
|
|
166
|
+
const radialV3Checkbox = document.getElementById('radial-v3');
|
|
167
|
+
if (radialV3Checkbox) {
|
|
168
|
+
radialV3Checkbox.checked = savedRadialV3 === 'true';
|
|
169
|
+
}
|
|
170
|
+
}
|
|
156
171
|
}
|
|
157
172
|
|
|
158
173
|
// ============================================================================
|
|
@@ -521,10 +536,14 @@ async function initRasterPath() {
|
|
|
521
536
|
rasterPath.terminate();
|
|
522
537
|
}
|
|
523
538
|
|
|
539
|
+
const radialV3Checkbox = document.getElementById('radial-v3');
|
|
540
|
+
const useRadialV3 = mode === 'radial' && radialV3Checkbox && radialV3Checkbox.checked;
|
|
541
|
+
|
|
524
542
|
rasterPath = new RasterPath({
|
|
525
543
|
mode: mode,
|
|
526
544
|
resolution: resolution,
|
|
527
545
|
rotationStep: mode === 'radial' ? angleStep : undefined,
|
|
546
|
+
radialV3: useRadialV3,
|
|
528
547
|
batchDivisor: 5,
|
|
529
548
|
debug: true
|
|
530
549
|
});
|
|
@@ -1442,6 +1461,7 @@ function updateModeUI() {
|
|
|
1442
1461
|
const traceStepContainer = document.getElementById('trace-step-container').classList;
|
|
1443
1462
|
const xStepContainer = document.getElementById('x-step-container').classList;
|
|
1444
1463
|
const yStepContainer = document.getElementById('y-step-container').classList;
|
|
1464
|
+
const radialV3Container = document.getElementById('radial-v3-container').classList;
|
|
1445
1465
|
|
|
1446
1466
|
if (mode === 'radial') {
|
|
1447
1467
|
wrappedContainer.remove('hide');
|
|
@@ -1449,6 +1469,7 @@ function updateModeUI() {
|
|
|
1449
1469
|
traceStepContainer.add('hide');
|
|
1450
1470
|
xStepContainer.remove('hide');
|
|
1451
1471
|
yStepContainer.remove('hide');
|
|
1472
|
+
radialV3Container.remove('hide');
|
|
1452
1473
|
} else if (mode === 'tracing') {
|
|
1453
1474
|
wrappedContainer.add('hide');
|
|
1454
1475
|
angleStepContainer.add('hide');
|
|
@@ -1460,6 +1481,7 @@ function updateModeUI() {
|
|
|
1460
1481
|
wrappedContainer.add('hide');
|
|
1461
1482
|
angleStepContainer.add('hide');
|
|
1462
1483
|
traceStepContainer.add('hide');
|
|
1484
|
+
radialV3Container.add('hide');
|
|
1463
1485
|
xStepContainer.remove('hide');
|
|
1464
1486
|
yStepContainer.remove('hide');
|
|
1465
1487
|
}
|
|
@@ -1575,6 +1597,7 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|
|
1575
1597
|
modelRasterData = null; // Need to re-rasterize with new angle step
|
|
1576
1598
|
toolRasterData = null;
|
|
1577
1599
|
toolpathData = null;
|
|
1600
|
+
initRasterPath(); // Reinit with new angle step
|
|
1578
1601
|
}
|
|
1579
1602
|
saveParameters();
|
|
1580
1603
|
updateInfo(`Angle Step changed to ${angleStep}°`);
|
|
@@ -1591,6 +1614,19 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|
|
1591
1614
|
updateButtonStates();
|
|
1592
1615
|
});
|
|
1593
1616
|
|
|
1617
|
+
document.getElementById('radial-v3').addEventListener('change', (e) => {
|
|
1618
|
+
if (mode === 'radial') {
|
|
1619
|
+
modelRasterData = null; // Need to re-rasterize with different algorithm
|
|
1620
|
+
toolRasterData = null;
|
|
1621
|
+
toolpathData = null;
|
|
1622
|
+
initRasterPath(); // Reinit with V3 setting
|
|
1623
|
+
}
|
|
1624
|
+
saveParameters();
|
|
1625
|
+
const v3Status = e.target.checked ? 'V3 (experimental)' : 'V2 (default)';
|
|
1626
|
+
updateInfo(`Radial algorithm: ${v3Status}`);
|
|
1627
|
+
updateButtonStates();
|
|
1628
|
+
});
|
|
1629
|
+
|
|
1594
1630
|
// Tool size change
|
|
1595
1631
|
document.getElementById('tool-size').addEventListener('change', async (e) => {
|
|
1596
1632
|
toolSize = parseFloat(e.target.value);
|
package/build/index.html
CHANGED
|
@@ -92,6 +92,9 @@
|
|
|
92
92
|
<label id="trace-step-container" class="hide">
|
|
93
93
|
Trace Step (mm): <input type="number" id="trace-step" value="0.5" min="0.1" max="5" step="0.1" style="width: 60px;">
|
|
94
94
|
</label>
|
|
95
|
+
<label id="radial-v3-container" class="hide">
|
|
96
|
+
<input type="checkbox" id="radial-v3"> Use V3 (experimental)
|
|
97
|
+
</label>
|
|
95
98
|
</div>
|
|
96
99
|
|
|
97
100
|
<div class="section">
|
package/build/raster-path.js
CHANGED
|
@@ -111,6 +111,7 @@ export class RasterPath {
|
|
|
111
111
|
gpuMemorySafetyMargin: config.gpuMemorySafetyMargin ?? 0.8,
|
|
112
112
|
autoTiling: config.autoTiling ?? true,
|
|
113
113
|
batchDivisor: config.batchDivisor ?? 1, // For testing batching overhead
|
|
114
|
+
radialV3: config.radialV3 ?? false, // Use radial V3 pipeline (rotate-filter-toolpath)
|
|
114
115
|
debug: config.debug,
|
|
115
116
|
quiet: config.quiet
|
|
116
117
|
};
|
|
@@ -531,9 +532,13 @@ export class RasterPath {
|
|
|
531
532
|
resolve(data);
|
|
532
533
|
};
|
|
533
534
|
|
|
534
|
-
// Send entire pipeline to worker
|
|
535
|
+
// Send entire pipeline to worker (use V3 if configured)
|
|
536
|
+
const messageType = this.config.radialV3
|
|
537
|
+
? 'radial-generate-toolpaths-v3'
|
|
538
|
+
: 'radial-generate-toolpaths';
|
|
539
|
+
|
|
535
540
|
this.#sendMessage(
|
|
536
|
-
|
|
541
|
+
messageType,
|
|
537
542
|
{
|
|
538
543
|
triangles: triangles,
|
|
539
544
|
bucketData,
|