Freefall commited on
Commit
e6bf914
·
verified ·
1 Parent(s): fd9c30f

Add 3 files

Browse files
Files changed (3) hide show
  1. README.md +7 -5
  2. index.html +822 -19
  3. prompts.txt +2 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Space Oven Sim
3
- emoji: 🏆
4
- colorFrom: red
5
- colorTo: blue
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: space-oven-sim
3
+ emoji: 🐳
4
+ colorFrom: purple
5
+ colorTo: yellow
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,822 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>3D Oven Temperature Visualization</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/[email protected]/examples/js/controls/OrbitControls.min.js"></script>
10
+ <script src="https://cdn.jsdelivr.net/npm/[email protected]/examples/js/loaders/GLTFLoader.min.js"></script>
11
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
12
+ <style>
13
+ #temperature-display {
14
+ background: rgba(0, 0, 0, 0.7);
15
+ border-radius: 16px;
16
+ padding: 20px;
17
+ color: white;
18
+ font-family: 'Arial', sans-serif;
19
+ backdrop-filter: blur(10px);
20
+ border: 1px solid rgba(255, 255, 255, 0.1);
21
+ box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
22
+ }
23
+ .sensor-label {
24
+ font-size: 12px;
25
+ color: white;
26
+ background: rgba(0, 0, 0, 0.7);
27
+ padding: 4px 8px;
28
+ border-radius: 12px;
29
+ pointer-events: none;
30
+ border: 1px solid rgba(255, 255, 255, 0.1);
31
+ }
32
+ #controls {
33
+ position: absolute;
34
+ bottom: 20px;
35
+ left: 50%;
36
+ transform: translateX(-50%);
37
+ z-index: 100;
38
+ display: flex;
39
+ gap: 12px;
40
+ background: rgba(0, 0, 0, 0.7);
41
+ padding: 12px 20px;
42
+ border-radius: 16px;
43
+ backdrop-filter: blur(10px);
44
+ border: 1px solid rgba(255, 255, 255, 0.1);
45
+ box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
46
+ }
47
+ #loading {
48
+ position: absolute;
49
+ top: 50%;
50
+ left: 50%;
51
+ transform: translate(-50%, -50%);
52
+ color: white;
53
+ font-size: 24px;
54
+ z-index: 1000;
55
+ background: rgba(0, 0, 0, 0.7);
56
+ padding: 20px 30px;
57
+ border-radius: 16px;
58
+ backdrop-filter: blur(10px);
59
+ border: 1px solid rgba(255, 255, 255, 0.1);
60
+ }
61
+ .temperature-bar {
62
+ height: 24px;
63
+ background: linear-gradient(to right, #0000ff, #00ffff, #00ff00, #ffff00, #ff0000);
64
+ border-radius: 12px;
65
+ margin-top: 12px;
66
+ position: relative;
67
+ overflow: hidden;
68
+ }
69
+ .temperature-marker {
70
+ position: absolute;
71
+ top: -24px;
72
+ transform: translateX(-50%);
73
+ color: white;
74
+ font-size: 12px;
75
+ text-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
76
+ }
77
+ .temperature-indicator {
78
+ position: absolute;
79
+ top: 0;
80
+ height: 100%;
81
+ width: 2px;
82
+ background: white;
83
+ transform: translateX(-50%);
84
+ box-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
85
+ }
86
+ #sensor-info {
87
+ position: absolute;
88
+ top: 20px;
89
+ right: 20px;
90
+ background: rgba(0, 0, 0, 0.7);
91
+ padding: 16px;
92
+ border-radius: 16px;
93
+ color: white;
94
+ max-width: 300px;
95
+ backdrop-filter: blur(10px);
96
+ border: 1px solid rgba(255, 255, 255, 0.1);
97
+ box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
98
+ opacity: 0;
99
+ transition: opacity 0.3s;
100
+ }
101
+ #sensor-info.visible {
102
+ opacity: 1;
103
+ }
104
+ #time-display {
105
+ position: absolute;
106
+ top: 50%;
107
+ left: 50%;
108
+ transform: translate(-50%, -50%);
109
+ font-size: 48px;
110
+ color: white;
111
+ text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
112
+ opacity: 0;
113
+ transition: opacity 0.3s;
114
+ pointer-events: none;
115
+ }
116
+ #time-display.visible {
117
+ opacity: 0.7;
118
+ }
119
+ .btn {
120
+ transition: all 0.2s;
121
+ display: flex;
122
+ align-items: center;
123
+ justify-content: center;
124
+ gap: 8px;
125
+ }
126
+ .btn i {
127
+ font-size: 16px;
128
+ }
129
+ input[type="range"] {
130
+ -webkit-appearance: none;
131
+ height: 6px;
132
+ background: rgba(255, 255, 255, 0.2);
133
+ border-radius: 3px;
134
+ }
135
+ input[type="range"]::-webkit-slider-thumb {
136
+ -webkit-appearance: none;
137
+ width: 18px;
138
+ height: 18px;
139
+ border-radius: 50%;
140
+ background: #3b82f6;
141
+ cursor: pointer;
142
+ transition: all 0.2s;
143
+ }
144
+ input[type="range"]::-webkit-slider-thumb:hover {
145
+ background: #2563eb;
146
+ transform: scale(1.1);
147
+ }
148
+ .sensor-hotspot {
149
+ position: absolute;
150
+ width: 12px;
151
+ height: 12px;
152
+ border-radius: 50%;
153
+ background: rgba(255, 0, 0, 0.5);
154
+ pointer-events: none;
155
+ transform: translate(-50%, -50%);
156
+ z-index: 10;
157
+ }
158
+ .tooltip {
159
+ position: absolute;
160
+ background: rgba(0, 0, 0, 0.8);
161
+ color: white;
162
+ padding: 6px 12px;
163
+ border-radius: 6px;
164
+ font-size: 12px;
165
+ pointer-events: none;
166
+ z-index: 100;
167
+ white-space: nowrap;
168
+ }
169
+ </style>
170
+ </head>
171
+ <body class="bg-gray-900 text-white overflow-hidden">
172
+ <div id="loading">
173
+ <div class="flex flex-col items-center">
174
+ <div class="animate-spin rounded-full h-12 w-12 border-t-2 border-b-2 border-blue-500 mb-4"></div>
175
+ <div>Loading 3D visualization...</div>
176
+ </div>
177
+ </div>
178
+
179
+ <div id="temperature-display" class="fixed top-4 left-4 z-50">
180
+ <h2 class="text-xl font-bold mb-3 flex items-center gap-2">
181
+ <i class="fas fa-fire"></i> Oven Temperature Monitoring
182
+ </h2>
183
+ <div class="flex justify-between mb-2">
184
+ <span id="current-time" class="flex items-center gap-1">
185
+ <i class="fas fa-clock"></i> Time: 0.0s
186
+ </span>
187
+ <span id="oven-temp" class="flex items-center gap-1">
188
+ <i class="fas fa-thermometer-half"></i> Oven: 0.0°C
189
+ </span>
190
+ </div>
191
+ <div class="temperature-bar">
192
+ <div class="temperature-marker" style="left: 0%">0°C</div>
193
+ <div class="temperature-marker" style="left: 20%">20°C</div>
194
+ <div class="temperature-marker" style="left: 40%">40°C</div>
195
+ <div class="temperature-marker" style="left: 60%">60°C</div>
196
+ <div class="temperature-marker" style="left: 80%">80°C</div>
197
+ <div class="temperature-marker" style="left: 100%">100°C</div>
198
+ <div id="current-temp-indicator" class="temperature-indicator" style="left: 0%"></div>
199
+ </div>
200
+ </div>
201
+
202
+ <div id="sensor-info">
203
+ <h3 class="font-bold text-lg mb-2">Sensor Details</h3>
204
+ <div class="grid grid-cols-2 gap-2">
205
+ <div>Sensor ID:</div>
206
+ <div id="sensor-id" class="font-mono">-</div>
207
+ <div>Position:</div>
208
+ <div id="sensor-pos" class="font-mono">-</div>
209
+ <div>Temperature:</div>
210
+ <div id="sensor-temp" class="font-mono">- °C</div>
211
+ <div>Status:</div>
212
+ <div id="sensor-status" class="font-mono">-</div>
213
+ </div>
214
+ </div>
215
+
216
+ <div id="time-display">0.0s</div>
217
+
218
+ <div id="controls">
219
+ <button id="play-btn" class="btn bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded">
220
+ <i class="fas fa-play"></i> Play
221
+ </button>
222
+ <button id="pause-btn" class="btn bg-yellow-600 hover:bg-yellow-700 text-white px-4 py-2 rounded">
223
+ <i class="fas fa-pause"></i> Pause
224
+ </button>
225
+ <button id="reset-btn" class="btn bg-red-600 hover:bg-red-700 text-white px-4 py-2 rounded">
226
+ <i class="fas fa-undo"></i> Reset
227
+ </button>
228
+ <button id="speed-down" class="btn bg-gray-600 hover:bg-gray-700 text-white px-3 py-2 rounded">
229
+ <i class="fas fa-backward"></i>
230
+ </button>
231
+ <input id="time-slider" type="range" min="0" max="100" value="0" class="w-64">
232
+ <button id="speed-up" class="btn bg-gray-600 hover:bg-gray-700 text-white px-3 py-2 rounded">
233
+ <i class="fas fa-forward"></i>
234
+ </button>
235
+ <div id="speed-display" class="text-white px-2 flex items-center">1x</div>
236
+ </div>
237
+
238
+ <script>
239
+ // Enhanced sample data with more realistic temperature variations
240
+ const sampleData = (() => {
241
+ const timePoints = Array.from({length: 101}, (_, i) => i); // 0 to 100 seconds
242
+ const ovenTemps = timePoints.map(t => {
243
+ // Simulate oven heating curve with some variation
244
+ if (t < 20) return 20 + t * 1.5; // Initial rapid heating
245
+ if (t < 60) return 50 + (t - 20) * 0.8; // Slower heating
246
+ if (t < 80) return 82 + (t - 60) * 0.4; // Approaching target
247
+ return 90 + (t - 80) * 0.2; // Final stabilization
248
+ });
249
+
250
+ const data = {
251
+ "Time_(s)": timePoints,
252
+ "Oven_Mon": ovenTemps
253
+ };
254
+
255
+ // Generate sensor data with realistic spatial variations
256
+ for (let i = 1; i <= 15; i++) {
257
+ const sensorId = i.toString();
258
+ const pos = sensorPositions[sensorId];
259
+
260
+ // Base temperature follows oven but with position-based variations
261
+ data[sensorId] = ovenTemps.map((temp, idx) => {
262
+ // Position factors (0-1) affecting temperature
263
+ const heightFactor = pos[2] / 14; // Z position (bottom to top)
264
+ const cornerFactor = (pos[0] === 2 || pos[0] === 12 || pos[1] === 2 || pos[1] === 12) ? 0.9 : 1;
265
+
266
+ // Time-based variation
267
+ const timeVar = Math.sin(idx / 10) * 0.5;
268
+
269
+ // Calculate final temperature with variations
270
+ return temp * (0.95 + heightFactor * 0.1) * cornerFactor + timeVar + (Math.random() - 0.5);
271
+ });
272
+ }
273
+
274
+ return data;
275
+ })();
276
+
277
+ // Sensor positions (x, y, z in inches)
278
+ const sensorPositions = {
279
+ '1': [2, 2, 2], // left, front, bottom
280
+ '2': [2, 12, 2], // left, back, bottom
281
+ '3': [12, 12, 2], // right, back, bottom
282
+ '4': [12, 2, 2], // right, front, bottom
283
+ '5': [7, 7, 2], // center, center, bottom
284
+ '6': [2, 2, 7], // left, front, middle
285
+ '7': [2, 12, 7], // left, back, middle
286
+ '8': [12, 12, 7], // right, back, middle
287
+ '9': [12, 2, 7], // right, front, middle
288
+ '10': [7, 7, 7], // center, center, middle
289
+ '11': [2, 2, 12], // left, front, top
290
+ '12': [2, 12, 12], // left, back, top
291
+ '13': [12, 12, 12],// right, back, top
292
+ '14': [12, 2, 12], // right, front, top
293
+ '15': [7, 7, 12] // center, center, top
294
+ };
295
+
296
+ // Initialize Three.js scene
297
+ let scene, camera, renderer, controls;
298
+ let oven, sensors = [], sensorLabels = [];
299
+ let currentFrame = 0;
300
+ let isPlaying = false;
301
+ let animationId = null;
302
+ let playbackSpeed = 1;
303
+ let lastFrameTime = 0;
304
+ const totalFrames = sampleData["Time_(s)"].length;
305
+ let raycaster = new THREE.Raycaster();
306
+ let mouse = new THREE.Vector2();
307
+ let hoveredSensor = null;
308
+ let tooltip = null;
309
+
310
+ function init() {
311
+ // Create scene
312
+ scene = new THREE.Scene();
313
+ scene.background = new THREE.Color(0x111111);
314
+ scene.fog = new THREE.FogExp2(0x111111, 0.002);
315
+
316
+ // Create camera
317
+ camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);
318
+ camera.position.set(25, 25, 25);
319
+
320
+ // Create renderer with better quality settings
321
+ renderer = new THREE.WebGLRenderer({
322
+ antialias: true,
323
+ powerPreference: "high-performance"
324
+ });
325
+ renderer.setPixelRatio(window.devicePixelRatio);
326
+ renderer.setSize(window.innerWidth, window.innerHeight);
327
+ renderer.shadowMap.enabled = true;
328
+ renderer.shadowMap.type = THREE.PCFSoftShadowMap;
329
+ document.body.appendChild(renderer.domElement);
330
+
331
+ // Add orbit controls with improved UX
332
+ controls = new THREE.OrbitControls(camera, renderer.domElement);
333
+ controls.enableDamping = true;
334
+ controls.dampingFactor = 0.25;
335
+ controls.screenSpacePanning = false;
336
+ controls.maxPolarAngle = Math.PI;
337
+ controls.minDistance = 10;
338
+ controls.maxDistance = 50;
339
+
340
+ // Add enhanced lighting
341
+ const ambientLight = new THREE.AmbientLight(0x404040, 0.5);
342
+ scene.add(ambientLight);
343
+
344
+ const directionalLight = new THREE.DirectionalLight(0xffffff, 0.8);
345
+ directionalLight.position.set(1, 1, 1);
346
+ directionalLight.castShadow = true;
347
+ directionalLight.shadow.mapSize.width = 1024;
348
+ directionalLight.shadow.mapSize.height = 1024;
349
+ scene.add(directionalLight);
350
+
351
+ const hemisphereLight = new THREE.HemisphereLight(0xffffbb, 0x080820, 0.3);
352
+ scene.add(hemisphereLight);
353
+
354
+ // Create oven structure with more details
355
+ createOven();
356
+
357
+ // Create sensors with better visuals
358
+ createSensors();
359
+
360
+ // Create tooltip element
361
+ createTooltip();
362
+
363
+ // Handle window resize
364
+ window.addEventListener('resize', onWindowResize);
365
+
366
+ // Setup event listeners for controls
367
+ setupControls();
368
+
369
+ // Setup mouse interaction
370
+ setupMouseInteraction();
371
+
372
+ // Hide loading message
373
+ document.getElementById('loading').style.display = 'none';
374
+
375
+ // Start animation loop
376
+ animate();
377
+ }
378
+
379
+ function createOven() {
380
+ // Oven dimensions (14x14x14 inches)
381
+ const ovenSize = 14;
382
+ const wallThickness = 0.2;
383
+
384
+ // Create oven frame (wireframe)
385
+ const geometry = new THREE.BoxGeometry(ovenSize, ovenSize, ovenSize);
386
+ const edges = new THREE.EdgesGeometry(geometry);
387
+ const line = new THREE.LineSegments(
388
+ edges,
389
+ new THREE.LineBasicMaterial({
390
+ color: 0xffffff,
391
+ transparent: true,
392
+ opacity: 0.7
393
+ })
394
+ );
395
+ scene.add(line);
396
+
397
+ // Create transparent oven walls
398
+ const wallMaterial = new THREE.MeshPhongMaterial({
399
+ color: 0x333333,
400
+ transparent: true,
401
+ opacity: 0.2,
402
+ side: THREE.DoubleSide
403
+ });
404
+
405
+ // Create walls (excluding front)
406
+ const walls = new THREE.Group();
407
+
408
+ // Back wall
409
+ const backWall = new THREE.Mesh(
410
+ new THREE.PlaneGeometry(ovenSize, ovenSize),
411
+ wallMaterial
412
+ );
413
+ backWall.position.set(7, 7, 14);
414
+ backWall.rotation.y = Math.PI;
415
+ walls.add(backWall);
416
+
417
+ // Left wall
418
+ const leftWall = new THREE.Mesh(
419
+ new THREE.PlaneGeometry(ovenSize, ovenSize),
420
+ wallMaterial
421
+ );
422
+ leftWall.position.set(0, 7, 7);
423
+ leftWall.rotation.y = Math.PI / 2;
424
+ walls.add(leftWall);
425
+
426
+ // Right wall
427
+ const rightWall = new THREE.Mesh(
428
+ new THREE.PlaneGeometry(ovenSize, ovenSize),
429
+ wallMaterial
430
+ );
431
+ rightWall.position.set(14, 7, 7);
432
+ rightWall.rotation.y = -Math.PI / 2;
433
+ walls.add(rightWall);
434
+
435
+ // Top wall
436
+ const topWall = new THREE.Mesh(
437
+ new THREE.PlaneGeometry(ovenSize, ovenSize),
438
+ wallMaterial
439
+ );
440
+ topWall.position.set(7, 14, 7);
441
+ topWall.rotation.x = -Math.PI / 2;
442
+ walls.add(topWall);
443
+
444
+ // Bottom wall
445
+ const bottomWall = new THREE.Mesh(
446
+ new THREE.PlaneGeometry(ovenSize, ovenSize),
447
+ wallMaterial
448
+ );
449
+ bottomWall.position.set(7, 0, 7);
450
+ bottomWall.rotation.x = Math.PI / 2;
451
+ walls.add(bottomWall);
452
+
453
+ scene.add(walls);
454
+
455
+ // Create door on front face
456
+ const doorGeometry = new THREE.PlaneGeometry(12, 12);
457
+ const doorMaterial = new THREE.MeshPhongMaterial({
458
+ color: 0x555555,
459
+ transparent: true,
460
+ opacity: 0.3,
461
+ side: THREE.DoubleSide,
462
+ specular: 0x111111,
463
+ shininess: 30
464
+ });
465
+ const door = new THREE.Mesh(doorGeometry, doorMaterial);
466
+ door.position.set(7, 7, 0);
467
+ door.rotation.y = Math.PI / 2;
468
+ scene.add(door);
469
+
470
+ // Add door frame
471
+ const doorFrameGeometry = new THREE.BoxGeometry(12.2, 12.2, 0.5);
472
+ const doorFrameEdges = new THREE.EdgesGeometry(doorFrameGeometry);
473
+ const doorFrame = new THREE.LineSegments(
474
+ doorFrameEdges,
475
+ new THREE.LineBasicMaterial({ color: 0xaaaaaa })
476
+ );
477
+ doorFrame.position.set(7, 7, 0);
478
+ doorFrame.rotation.y = Math.PI / 2;
479
+ scene.add(doorFrame);
480
+
481
+ // Add door handle
482
+ const handleGeometry = new THREE.CylinderGeometry(0.3, 0.3, 2, 32);
483
+ const handleMaterial = new THREE.MeshPhongMaterial({
484
+ color: 0xcccccc,
485
+ specular: 0x111111,
486
+ shininess: 30
487
+ });
488
+ const handle = new THREE.Mesh(handleGeometry, handleMaterial);
489
+ handle.position.set(12, 7, 0);
490
+ handle.rotation.z = Math.PI / 2;
491
+ scene.add(handle);
492
+
493
+ // Add "FRONT" label
494
+ const frontLabel = createTextLabel("OVEN DOOR", 7, 7, -1, 0xffffff);
495
+ scene.add(frontLabel);
496
+
497
+ // Add grid helper to show floor
498
+ const gridHelper = new THREE.GridHelper(20, 20, 0x555555, 0x333333);
499
+ gridHelper.position.set(7, 0, 7);
500
+ scene.add(gridHelper);
501
+ }
502
+
503
+ function createSensors() {
504
+ // Create sensor spheres and labels
505
+ for (let i = 1; i <= 15; i++) {
506
+ const sensorId = i.toString();
507
+ const pos = sensorPositions[sensorId];
508
+
509
+ // Create sensor sphere with better material
510
+ const geometry = new THREE.SphereGeometry(0.5, 24, 24);
511
+ const material = new THREE.MeshPhongMaterial({
512
+ color: 0x00ff00,
513
+ specular: 0x111111,
514
+ shininess: 30,
515
+ emissive: 0x000000,
516
+ emissiveIntensity: 0
517
+ });
518
+ const sphere = new THREE.Mesh(geometry, material);
519
+ sphere.position.set(pos[0], pos[1], pos[2]);
520
+ sphere.castShadow = true;
521
+ sphere.receiveShadow = true;
522
+ sphere.userData.sensorId = sensorId;
523
+ scene.add(sphere);
524
+ sensors.push(sphere);
525
+
526
+ // Create sensor label with better styling
527
+ const label = createTextLabel(`S-${sensorId}`, pos[0], pos[1] + 1.2, pos[2], 0xffffff);
528
+ scene.add(label);
529
+ sensorLabels.push(label);
530
+ }
531
+ }
532
+
533
+ function createTextLabel(text, x, y, z, color) {
534
+ const canvas = document.createElement('canvas');
535
+ canvas.width = 256;
536
+ canvas.height = 128;
537
+ const context = canvas.getContext('2d');
538
+
539
+ // Draw rounded rectangle background
540
+ context.beginPath();
541
+ context.roundRect(0, 0, canvas.width, canvas.height, 16);
542
+ context.fillStyle = 'rgba(0, 0, 0, 0.7)';
543
+ context.fill();
544
+
545
+ // Draw border
546
+ context.strokeStyle = 'rgba(255, 255, 255, 0.2)';
547
+ context.lineWidth = 2;
548
+ context.stroke();
549
+
550
+ // Draw text
551
+ context.font = 'Bold 24px Arial';
552
+ context.fillStyle = '#ffffff';
553
+ context.textAlign = 'center';
554
+ context.textBaseline = 'middle';
555
+ context.fillText(text, canvas.width / 2, canvas.height / 2);
556
+
557
+ const texture = new THREE.CanvasTexture(canvas);
558
+ const material = new THREE.SpriteMaterial({
559
+ map: texture,
560
+ transparent: true
561
+ });
562
+ const sprite = new THREE.Sprite(material);
563
+ sprite.position.set(x, y, z);
564
+ sprite.scale.set(5, 2.5, 1);
565
+ sprite.userData.isLabel = true;
566
+ return sprite;
567
+ }
568
+
569
+ function createTooltip() {
570
+ tooltip = document.createElement('div');
571
+ tooltip.className = 'tooltip';
572
+ tooltip.style.display = 'none';
573
+ document.body.appendChild(tooltip);
574
+ }
575
+
576
+ function updateTemperatureColors(frame) {
577
+ const ovenTemp = sampleData["Oven_Mon"][frame];
578
+ const normalizedOvenTemp = Math.min(Math.max((ovenTemp - 20) / 80, 0), 1);
579
+
580
+ // Update temperature indicator position
581
+ document.getElementById('current-temp-indicator').style.left = `${normalizedOvenTemp * 100}%`;
582
+
583
+ // Update all sensors with temperature data for the current frame
584
+ let maxTemp = 20;
585
+ let minTemp = 20;
586
+
587
+ for (let i = 1; i <= 15; i++) {
588
+ const sensorId = i.toString();
589
+ const temp = sampleData[sensorId][frame];
590
+
591
+ // Update min/max for status calculation
592
+ if (temp > maxTemp) maxTemp = temp;
593
+ if (temp < minTemp) minTemp = temp;
594
+
595
+ // Calculate color based on temperature (blue to red gradient)
596
+ const normalizedTemp = Math.min(Math.max((temp - 20) / 80, 0), 1);
597
+ const color = new THREE.Color();
598
+ color.setHSL((1 - normalizedTemp) * 0.7, 1, 0.5);
599
+
600
+ // Update sensor color and emissive (glow effect for hot sensors)
601
+ sensors[i-1].material.color = color;
602
+ sensors[i-1].material.emissiveIntensity = normalizedTemp * 0.5;
603
+
604
+ // Update sensor label position to always face camera
605
+ const pos = sensorPositions[sensorId];
606
+ sensorLabels[i-1].position.set(pos[0], pos[1] + 1.2, pos[2]);
607
+ sensorLabels[i-1].lookAt(camera.position);
608
+ }
609
+
610
+ // Update time and oven temperature display
611
+ document.getElementById('current-time').textContent = `Time: ${sampleData["Time_(s)"][frame].toFixed(1)}s`;
612
+ document.getElementById('oven-temp').textContent = `Oven: ${ovenTemp.toFixed(1)}°C`;
613
+
614
+ // Briefly show large time display
615
+ showTimeDisplay(sampleData["Time_(s)"][frame].toFixed(1) + 's');
616
+
617
+ // Update slider position
618
+ document.getElementById('time-slider').value = (frame / (totalFrames - 1)) * 100;
619
+
620
+ // Update hovered sensor info if any
621
+ if (hoveredSensor) {
622
+ updateSensorInfo(hoveredSensor.userData.sensorId, frame);
623
+ }
624
+ }
625
+
626
+ function showTimeDisplay(text) {
627
+ const display = document.getElementById('time-display');
628
+ display.textContent = text;
629
+ display.classList.add('visible');
630
+
631
+ setTimeout(() => {
632
+ display.classList.remove('visible');
633
+ }, 1000);
634
+ }
635
+
636
+ function updateSensorInfo(sensorId, frame) {
637
+ const temp = sampleData[sensorId][frame];
638
+ const pos = sensorPositions[sensorId];
639
+
640
+ document.getElementById('sensor-id').textContent = sensorId;
641
+ document.getElementById('sensor-pos').textContent = `${pos[0]}, ${pos[1]}, ${pos[2]}`;
642
+ document.getElementById('sensor-temp').textContent = `${temp.toFixed(1)}°C`;
643
+
644
+ // Determine status based on temperature
645
+ let status = '';
646
+ let statusClass = '';
647
+ if (temp < 30) {
648
+ status = 'Cool';
649
+ statusClass = 'text-blue-400';
650
+ } else if (temp < 60) {
651
+ status = 'Warm';
652
+ statusClass = 'text-green-400';
653
+ } else if (temp < 80) {
654
+ status = 'Hot';
655
+ statusClass = 'text-yellow-400';
656
+ } else {
657
+ status = 'Very Hot';
658
+ statusClass = 'text-red-400';
659
+ }
660
+
661
+ const statusElement = document.getElementById('sensor-status');
662
+ statusElement.textContent = status;
663
+ statusElement.className = `font-mono ${statusClass}`;
664
+
665
+ // Show sensor info panel
666
+ document.getElementById('sensor-info').classList.add('visible');
667
+ }
668
+
669
+ function setupControls() {
670
+ // Play button
671
+ document.getElementById('play-btn').addEventListener('click', () => {
672
+ if (!isPlaying) {
673
+ isPlaying = true;
674
+ lastFrameTime = performance.now();
675
+ playAnimation();
676
+ }
677
+ });
678
+
679
+ // Pause button
680
+ document.getElementById('pause-btn').addEventListener('click', () => {
681
+ isPlaying = false;
682
+ if (animationId) {
683
+ cancelAnimationFrame(animationId);
684
+ animationId = null;
685
+ }
686
+ });
687
+
688
+ // Reset button
689
+ document.getElementById('reset-btn').addEventListener('click', () => {
690
+ isPlaying = false;
691
+ if (animationId) {
692
+ cancelAnimationFrame(animationId);
693
+ animationId = null;
694
+ }
695
+ currentFrame = 0;
696
+ updateTemperatureColors(currentFrame);
697
+ });
698
+
699
+ // Speed down button
700
+ document.getElementById('speed-down').addEventListener('click', () => {
701
+ playbackSpeed = Math.max(0.25, playbackSpeed / 2);
702
+ updateSpeedDisplay();
703
+ });
704
+
705
+ // Speed up button
706
+ document.getElementById('speed-up').addEventListener('click', () => {
707
+ playbackSpeed = Math.min(4, playbackSpeed * 2);
708
+ updateSpeedDisplay();
709
+ });
710
+
711
+ // Time slider
712
+ document.getElementById('time-slider').addEventListener('input', (e) => {
713
+ const frame = Math.round((e.target.value / 100) * (totalFrames - 1));
714
+ if (frame !== currentFrame) {
715
+ currentFrame = frame;
716
+ updateTemperatureColors(currentFrame);
717
+ }
718
+ });
719
+ }
720
+
721
+ function updateSpeedDisplay() {
722
+ document.getElementById('speed-display').textContent = `${playbackSpeed}x`;
723
+ }
724
+
725
+ function setupMouseInteraction() {
726
+ // Mouse move event for hover effects
727
+ window.addEventListener('mousemove', (event) => {
728
+ // Calculate mouse position in normalized device coordinates
729
+ mouse.x = (event.clientX / window.innerWidth) * 2 - 1;
730
+ mouse.y = -(event.clientY / window.innerHeight) * 2 + 1;
731
+
732
+ // Update the raycaster
733
+ raycaster.setFromCamera(mouse, camera);
734
+
735
+ // Calculate objects intersecting the raycaster
736
+ const intersects = raycaster.intersectObjects(sensors);
737
+
738
+ if (intersects.length > 0) {
739
+ const object = intersects[0].object;
740
+
741
+ // If we're hovering over a new sensor
742
+ if (!hoveredSensor || hoveredSensor.userData.sensorId !== object.userData.sensorId) {
743
+ hoveredSensor = object;
744
+
745
+ // Update tooltip position and content
746
+ const sensorId = object.userData.sensorId;
747
+ const temp = sampleData[sensorId][currentFrame];
748
+ const pos = sensorPositions[sensorId];
749
+
750
+ // Convert 3D position to screen coordinates
751
+ const vector = new THREE.Vector3(pos[0], pos[1], pos[2]);
752
+ vector.project(camera);
753
+
754
+ const x = (vector.x * 0.5 + 0.5) * window.innerWidth;
755
+ const y = (vector.y * -0.5 + 0.5) * window.innerHeight;
756
+
757
+ tooltip.style.display = 'block';
758
+ tooltip.style.left = `${x}px`;
759
+ tooltip.style.top = `${y}px`;
760
+ tooltip.textContent = `Sensor ${sensorId}: ${temp.toFixed(1)}°C`;
761
+
762
+ // Update sensor info panel
763
+ updateSensorInfo(sensorId, currentFrame);
764
+ }
765
+ } else {
766
+ // No intersection, hide tooltip and sensor info
767
+ if (hoveredSensor) {
768
+ tooltip.style.display = 'none';
769
+ document.getElementById('sensor-info').classList.remove('visible');
770
+ hoveredSensor = null;
771
+ }
772
+ }
773
+ });
774
+
775
+ // Click event for selecting sensors
776
+ window.addEventListener('click', () => {
777
+ if (hoveredSensor) {
778
+ // You could add additional click behavior here
779
+ }
780
+ });
781
+ }
782
+
783
+ function playAnimation() {
784
+ const now = performance.now();
785
+ const delta = now - lastFrameTime;
786
+ lastFrameTime = now;
787
+
788
+ // Advance frames based on playback speed and time elapsed
789
+ const framesToAdvance = (delta / 1000) * playbackSpeed * 5; // 5 = base speed factor
790
+
791
+ if (currentFrame >= totalFrames - 1) {
792
+ currentFrame = 0;
793
+ } else {
794
+ currentFrame = Math.min(totalFrames - 1, currentFrame + framesToAdvance);
795
+ }
796
+
797
+ updateTemperatureColors(Math.floor(currentFrame));
798
+
799
+ if (isPlaying && currentFrame < totalFrames - 1) {
800
+ animationId = requestAnimationFrame(playAnimation);
801
+ } else if (currentFrame >= totalFrames - 1) {
802
+ isPlaying = false;
803
+ }
804
+ }
805
+
806
+ function onWindowResize() {
807
+ camera.aspect = window.innerWidth / window.innerHeight;
808
+ camera.updateProjectionMatrix();
809
+ renderer.setSize(window.innerWidth, window.innerHeight);
810
+ }
811
+
812
+ function animate() {
813
+ requestAnimationFrame(animate);
814
+ controls.update();
815
+ renderer.render(scene, camera);
816
+ }
817
+
818
+ // Start the application
819
+ init();
820
+ </script>
821
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Freefall/space-oven-sim" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
822
+ </html>
prompts.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ fix this please
2
+ ?