@gridspace/raster-path 1.0.2 → 1.0.4

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.
@@ -0,0 +1,130 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Raster Path</title>
7
+ <link rel="stylesheet" href="style.css">
8
+ </head>
9
+ <body>
10
+ <div id="container">
11
+ <!-- Left Panel - Model Manipulation -->
12
+ <div class="model-controls">
13
+ <div class="section">
14
+ <h3>Model Rotation</h3>
15
+ <div class="rotation-controls">
16
+ <div class="rotation-row">
17
+ <span class="rotation-label">X:</span>
18
+ <button class="rotate-btn" data-axis="x" data-dir="-1">-90°</button>
19
+ <button class="rotate-btn" data-axis="x" data-dir="1">+90°</button>
20
+ </div>
21
+ <div class="rotation-row">
22
+ <span class="rotation-label">Y:</span>
23
+ <button class="rotate-btn" data-axis="y" data-dir="-1">-90°</button>
24
+ <button class="rotate-btn" data-axis="y" data-dir="1">+90°</button>
25
+ </div>
26
+ <div class="rotation-row">
27
+ <span class="rotation-label">Z:</span>
28
+ <button class="rotate-btn" data-axis="z" data-dir="-1">-90°</button>
29
+ <button class="rotate-btn" data-axis="z" data-dir="1">+90°</button>
30
+ </div>
31
+ <button id="reset-rotation" class="btn btn-small">Reset</button>
32
+ </div>
33
+ </div>
34
+
35
+ <div class="section">
36
+ <h3>Tool Size</h3>
37
+ <select id="tool-size">
38
+ <option value="1.0">1.0mm</option>
39
+ <option value="2.0">2.0mm</option>
40
+ <option value="2.5" selected>2.5mm</option>
41
+ <option value="3.0">3.0mm</option>
42
+ <option value="4.0">4.0mm</option>
43
+ <option value="5.0">5.0mm</option>
44
+ </select>
45
+ <div id="tool-size-status" class="status">No tool loaded</div>
46
+ </div>
47
+ </div>
48
+
49
+ <!-- Right Panel - Controls -->
50
+ <div class="controls">
51
+ <div class="section">
52
+ <h3>Mode</h3>
53
+ <div class="mode-toggle">
54
+ <label><input type="radio" name="mode" value="planar" checked> Planar</label>
55
+ <label><input type="radio" name="mode" value="radial"> Radial</label>
56
+ </div>
57
+ </div>
58
+
59
+ <div class="section">
60
+ <h3>Load STL</h3>
61
+ <button id="load-model" class="btn">Load Model</button>
62
+ <div id="model-status" class="status">No model loaded</div>
63
+ <button id="load-tool" class="btn">Load Tool</button>
64
+ <div id="tool-status" class="status">No tool loaded</div>
65
+ </div>
66
+
67
+ <div class="section">
68
+ <h3>Resolution</h3>
69
+ <select id="resolution">
70
+ <option value="0.100" selected>0.100mm</option>
71
+ <option value="0.050">0.050mm</option>
72
+ <option value="0.025">0.025mm</option>
73
+ <option value="0.010">0.010mm</option>
74
+ </select>
75
+ </div>
76
+
77
+ <div class="section">
78
+ <h3>Parameters</h3>
79
+ <label>
80
+ Z Floor: <input type="number" id="z-floor" value="-100" step="10" style="width: 70px;">
81
+ </label>
82
+ <label>
83
+ X Step: <input type="number" id="x-step" value="5" min="1" max="50" style="width: 60px;">
84
+ </label>
85
+ <label>
86
+ Y Step: <input type="number" id="y-step" value="5" min="1" max="50" style="width: 60px;">
87
+ </label>
88
+ <label id="angle-step-container" class="hide">
89
+ Angle Step (deg): <input type="number" id="angle-step" value="1" min="0.1" max="10" step="0.1" style="width: 60px;">
90
+ </label>
91
+ </div>
92
+
93
+ <div class="section">
94
+ <h3>Process</h3>
95
+ <button id="rasterize" class="btn" disabled>Rasterize</button>
96
+ <button id="generate-toolpath" class="btn" disabled>Generate Toolpath</button>
97
+ </div>
98
+
99
+ <div class="section">
100
+ <h3>View</h3>
101
+ <label><input type="checkbox" id="show-model" checked> Model</label>
102
+ <label><input type="checkbox" id="show-raster"> Raster</label>
103
+ <label><input type="checkbox" id="show-paths"> Toolpaths</label>
104
+ <label id="wrapped-container" class="hide">
105
+ <input type="checkbox" id="show-wrapped"> Wrapped
106
+ </label>
107
+ </div>
108
+
109
+ <div class="section">
110
+ <h3>Info</h3>
111
+ <div id="info" class="info-text">Ready</div>
112
+ </div>
113
+ </div>
114
+
115
+ <!-- 3D Canvas -->
116
+ <canvas id="canvas"></canvas>
117
+ </div>
118
+
119
+ <script type="importmap">
120
+ {
121
+ "imports": {
122
+ "three": "https://cdn.jsdelivr.net/npm/three@0.160.0/build/three.module.js",
123
+ "three/addons/": "https://cdn.jsdelivr.net/npm/three@0.160.0/examples/jsm/"
124
+ }
125
+ }
126
+ </script>
127
+ <script type="module" src="app.js"></script>
128
+ <!-- <script type="module" src="webgpu-worker.js"></script> -->
129
+ </body>
130
+ </html>
@@ -0,0 +1,223 @@
1
+ * {
2
+ margin: 0;
3
+ padding: 0;
4
+ box-sizing: border-box;
5
+ }
6
+
7
+ body {
8
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
9
+ background: #1a1a1a;
10
+ color: #ffffff;
11
+ overflow: hidden;
12
+ }
13
+
14
+ #container {
15
+ width: 100vw;
16
+ height: 100vh;
17
+ position: relative;
18
+ }
19
+
20
+ #canvas {
21
+ display: block;
22
+ width: 100%;
23
+ height: 100%;
24
+ }
25
+
26
+ .model-controls {
27
+ position: absolute;
28
+ top: 20px;
29
+ left: 20px;
30
+ background: rgba(0, 0, 0, 0.85);
31
+ backdrop-filter: blur(10px);
32
+ border: 1px solid #333;
33
+ border-radius: 8px;
34
+ padding: 20px;
35
+ min-width: 200px;
36
+ max-width: 240px;
37
+ z-index: 100;
38
+ }
39
+
40
+ .controls {
41
+ position: absolute;
42
+ top: 20px;
43
+ right: 20px;
44
+ bottom: 20px;
45
+ overflow-y: auto;
46
+ background: rgba(0, 0, 0, 0.85);
47
+ backdrop-filter: blur(10px);
48
+ border: 1px solid #333;
49
+ border-radius: 8px;
50
+ padding: 20px;
51
+ min-width: 220px;
52
+ max-width: 280px;
53
+ z-index: 100;
54
+ }
55
+
56
+ .section {
57
+ margin-bottom: 20px;
58
+ padding-bottom: 15px;
59
+ border-bottom: 1px solid #333;
60
+ }
61
+
62
+ .section:last-child {
63
+ border-bottom: none;
64
+ margin-bottom: 0;
65
+ }
66
+
67
+ .section h3 {
68
+ font-size: 13px;
69
+ color: #00ffff;
70
+ margin-bottom: 10px;
71
+ font-weight: 600;
72
+ text-transform: uppercase;
73
+ letter-spacing: 0.5px;
74
+ }
75
+
76
+ .mode-toggle {
77
+ display: flex;
78
+ gap: 12px;
79
+ }
80
+
81
+ .mode-toggle label {
82
+ display: flex;
83
+ align-items: center;
84
+ gap: 6px;
85
+ font-size: 13px;
86
+ cursor: pointer;
87
+ }
88
+
89
+ .mode-toggle input[type="radio"] {
90
+ cursor: pointer;
91
+ accent-color: #00ffff;
92
+ }
93
+
94
+ .btn {
95
+ width: 100%;
96
+ padding: 10px;
97
+ margin-bottom: 8px;
98
+ font-size: 13px;
99
+ font-weight: 600;
100
+ background: rgba(0, 255, 255, 0.1);
101
+ border: 1px solid #00ffff;
102
+ border-radius: 6px;
103
+ color: #00ffff;
104
+ cursor: pointer;
105
+ transition: all 0.2s ease;
106
+ }
107
+
108
+ .btn:hover:not(:disabled) {
109
+ background: rgba(0, 255, 255, 0.2);
110
+ box-shadow: 0 0 8px rgba(0, 255, 255, 0.3);
111
+ }
112
+
113
+ .btn:active:not(:disabled) {
114
+ background: rgba(0, 255, 255, 0.3);
115
+ transform: translateY(1px);
116
+ }
117
+
118
+ .btn:disabled {
119
+ opacity: 0.3;
120
+ cursor: not-allowed;
121
+ border-color: #666;
122
+ color: #666;
123
+ }
124
+
125
+ .status {
126
+ font-size: 11px;
127
+ color: #888;
128
+ margin-bottom: 12px;
129
+ font-style: italic;
130
+ }
131
+
132
+ select {
133
+ width: 100%;
134
+ padding: 8px;
135
+ font-size: 13px;
136
+ background: rgba(0, 0, 0, 0.6);
137
+ border: 1px solid #00ffff;
138
+ border-radius: 6px;
139
+ color: #ffffff;
140
+ cursor: pointer;
141
+ }
142
+
143
+ select:focus {
144
+ outline: none;
145
+ border-color: #00cccc;
146
+ box-shadow: 0 0 8px rgba(0, 255, 255, 0.3);
147
+ }
148
+
149
+ label {
150
+ display: flex;
151
+ align-items: center;
152
+ gap: 8px;
153
+ font-size: 13px;
154
+ margin-bottom: 8px;
155
+ cursor: pointer;
156
+ }
157
+
158
+ input[type="checkbox"] {
159
+ cursor: pointer;
160
+ width: 16px;
161
+ height: 16px;
162
+ accent-color: #00ffff;
163
+ }
164
+
165
+ .info-text {
166
+ font-size: 12px;
167
+ color: #aaa;
168
+ line-height: 1.5;
169
+ white-space: pre-wrap;
170
+ }
171
+
172
+ .hide {
173
+ display: none;
174
+ }
175
+
176
+ /* Rotation controls */
177
+ .rotation-controls {
178
+ display: flex;
179
+ flex-direction: column;
180
+ gap: 8px;
181
+ }
182
+
183
+ .rotation-row {
184
+ display: flex;
185
+ align-items: center;
186
+ gap: 6px;
187
+ }
188
+
189
+ .rotation-label {
190
+ font-size: 13px;
191
+ font-weight: 600;
192
+ min-width: 18px;
193
+ color: #00ffff;
194
+ }
195
+
196
+ .rotate-btn {
197
+ flex: 1;
198
+ padding: 6px 10px;
199
+ font-size: 11px;
200
+ font-weight: 600;
201
+ background: rgba(0, 255, 255, 0.08);
202
+ border: 1px solid #00ffff;
203
+ border-radius: 4px;
204
+ color: #00ffff;
205
+ cursor: pointer;
206
+ transition: all 0.2s ease;
207
+ }
208
+
209
+ .rotate-btn:hover {
210
+ background: rgba(0, 255, 255, 0.15);
211
+ box-shadow: 0 0 6px rgba(0, 255, 255, 0.2);
212
+ }
213
+
214
+ .rotate-btn:active {
215
+ background: rgba(0, 255, 255, 0.25);
216
+ transform: scale(0.98);
217
+ }
218
+
219
+ .btn-small {
220
+ padding: 6px 10px;
221
+ font-size: 11px;
222
+ margin-top: 4px;
223
+ }