TheAiCollectiveART commited on
Commit
85ec86a
·
verified ·
1 Parent(s): ef5ee52

Update/Add WASM_U-Performance_Record/index.html for WebAssembly 7.10us record

Browse files
Files changed (1) hide show
  1. WASM_U-Performance_Record/index.html +586 -0
WASM_U-Performance_Record/index.html ADDED
@@ -0,0 +1,586 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>WASM U-Performance Record Sandbox</title>
7
+ <link rel="preconnect" href="https://fonts.googleapis.com">
8
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
9
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;800&family=Outfit:wght@400;700;900&display=swap" rel="stylesheet">
10
+ <style>
11
+ :root {
12
+ --bg-color: #090D16;
13
+ --primary: #63B3ED;
14
+ --primary-navy: #0F2D59;
15
+ --secondary: #1D4ED8;
16
+ --text-main: #E2E8F0;
17
+ --text-muted: #A0AEC0;
18
+ --accent: #FEB2B2;
19
+ --success: #48BB78;
20
+ --glass-bg: rgba(15, 23, 42, 0.65);
21
+ --glass-border: rgba(99, 179, 237, 0.15);
22
+ }
23
+
24
+ * {
25
+ box-sizing: border-box;
26
+ margin: 0;
27
+ padding: 0;
28
+ }
29
+
30
+ body {
31
+ font-family: 'Inter', sans-serif;
32
+ background-color: var(--bg-color);
33
+ color: var(--text-main);
34
+ min-height: 100vh;
35
+ display: flex;
36
+ flex-direction: column;
37
+ overflow-x: hidden;
38
+ }
39
+
40
+ header {
41
+ padding: 2rem 4rem;
42
+ display: flex;
43
+ justify-content: space-between;
44
+ align-items: center;
45
+ border-bottom: 1px solid var(--glass-border);
46
+ background: rgba(9, 13, 22, 0.8);
47
+ backdrop-filter: blur(10px);
48
+ z-index: 10;
49
+ }
50
+
51
+ .logo-block {
52
+ display: flex;
53
+ align-items: center;
54
+ gap: 1rem;
55
+ }
56
+
57
+ .logo-title {
58
+ font-family: 'Outfit', sans-serif;
59
+ font-size: 1.8rem;
60
+ font-weight: 900;
61
+ letter-spacing: -0.05em;
62
+ background: linear-gradient(135deg, #63B3ED 0%, #D6BCFA 100%);
63
+ -webkit-background-clip: text;
64
+ -webkit-text-fill-color: transparent;
65
+ }
66
+
67
+ .badge {
68
+ font-size: 0.75rem;
69
+ font-weight: 800;
70
+ padding: 0.25rem 0.75rem;
71
+ border-radius: 9999px;
72
+ text-transform: uppercase;
73
+ letter-spacing: 0.05em;
74
+ }
75
+
76
+ .badge.loading {
77
+ background-color: rgba(236, 201, 75, 0.2);
78
+ color: #ECC94B;
79
+ border: 1px solid rgba(236, 201, 75, 0.3);
80
+ }
81
+
82
+ .badge.ready {
83
+ background-color: rgba(72, 187, 120, 0.2);
84
+ color: var(--success);
85
+ border: 1px solid rgba(72, 187, 120, 0.3);
86
+ box-shadow: 0 0 15px rgba(72, 187, 120, 0.3);
87
+ }
88
+
89
+ main {
90
+ flex: 1;
91
+ padding: 3rem 4rem;
92
+ max-width: 1400px;
93
+ width: 100%;
94
+ margin: 0 auto;
95
+ display: grid;
96
+ grid-template-columns: 1fr 1fr;
97
+ gap: 3rem;
98
+ }
99
+
100
+ @media (max-width: 1024px) {
101
+ main {
102
+ grid-template-columns: 1fr;
103
+ }
104
+ }
105
+
106
+ .panel {
107
+ background: var(--glass-bg);
108
+ border: 1px solid var(--glass-border);
109
+ border-radius: 16px;
110
+ padding: 2rem;
111
+ backdrop-filter: blur(12px);
112
+ box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
113
+ display: flex;
114
+ flex-direction: column;
115
+ gap: 1.5rem;
116
+ }
117
+
118
+ h2 {
119
+ font-family: 'Outfit', sans-serif;
120
+ font-size: 1.4rem;
121
+ font-weight: 700;
122
+ color: var(--primary);
123
+ border-left: 4px solid var(--primary);
124
+ padding-left: 0.75rem;
125
+ }
126
+
127
+ textarea {
128
+ width: 100%;
129
+ height: 150px;
130
+ background: rgba(9, 13, 22, 0.6);
131
+ border: 1px solid var(--glass-border);
132
+ border-radius: 8px;
133
+ color: var(--text-main);
134
+ font-family: 'Courier New', Courier, monospace;
135
+ font-size: 0.9rem;
136
+ padding: 1rem;
137
+ resize: none;
138
+ outline: none;
139
+ }
140
+
141
+ textarea:focus {
142
+ border-color: var(--primary);
143
+ box-shadow: 0 0 10px rgba(99, 179, 237, 0.2);
144
+ }
145
+
146
+ .button-group {
147
+ display: flex;
148
+ gap: 1rem;
149
+ }
150
+
151
+ button {
152
+ flex: 1;
153
+ background: linear-gradient(135deg, var(--secondary) 0%, var(--primary-navy) 100%);
154
+ border: 1px solid rgba(99, 179, 237, 0.3);
155
+ border-radius: 8px;
156
+ color: white;
157
+ font-weight: 600;
158
+ padding: 0.75rem 1.5rem;
159
+ cursor: pointer;
160
+ transition: all 0.2s ease;
161
+ outline: none;
162
+ }
163
+
164
+ button:hover {
165
+ transform: translateY(-2px);
166
+ box-shadow: 0 5px 15px rgba(99, 179, 237, 0.3);
167
+ border-color: var(--primary);
168
+ }
169
+
170
+ button:active {
171
+ transform: translateY(0);
172
+ }
173
+
174
+ button.btn-accent {
175
+ background: linear-gradient(135deg, var(--success) 0%, #2F855A 100%);
176
+ border-color: rgba(72, 187, 120, 0.3);
177
+ }
178
+
179
+ button.btn-accent:hover {
180
+ box-shadow: 0 5px 15px rgba(72, 187, 120, 0.3);
181
+ }
182
+
183
+ .results-block {
184
+ background: rgba(9, 13, 22, 0.4);
185
+ border: 1px solid rgba(255, 255, 255, 0.05);
186
+ border-radius: 8px;
187
+ padding: 1rem;
188
+ display: flex;
189
+ flex-direction: column;
190
+ gap: 0.75rem;
191
+ }
192
+
193
+ .result-row {
194
+ display: flex;
195
+ justify-content: space-between;
196
+ font-size: 0.9rem;
197
+ }
198
+
199
+ .result-val {
200
+ font-weight: 600;
201
+ color: var(--primary);
202
+ }
203
+
204
+ .result-val.highlight {
205
+ color: var(--success);
206
+ font-weight: 800;
207
+ }
208
+
209
+ .visualizer-container {
210
+ position: relative;
211
+ width: 100%;
212
+ height: 300px;
213
+ background: rgba(5, 8, 16, 0.7);
214
+ border: 1px solid var(--glass-border);
215
+ border-radius: 8px;
216
+ overflow: hidden;
217
+ }
218
+
219
+ canvas {
220
+ width: 100%;
221
+ height: 100%;
222
+ display: block;
223
+ }
224
+
225
+ .logs-container {
226
+ flex: 1;
227
+ background: rgba(5, 8, 16, 0.7);
228
+ border: 1px solid var(--glass-border);
229
+ border-radius: 8px;
230
+ padding: 1rem;
231
+ font-family: 'Courier New', Courier, monospace;
232
+ font-size: 0.8rem;
233
+ overflow-y: auto;
234
+ max-height: 250px;
235
+ color: #48BB78;
236
+ }
237
+
238
+ footer {
239
+ padding: 2rem 4rem;
240
+ text-align: center;
241
+ font-size: 0.8rem;
242
+ color: var(--text-muted);
243
+ border-top: 1px solid var(--glass-border);
244
+ margin-top: 3rem;
245
+ background: rgba(9, 13, 22, 0.8);
246
+ }
247
+ </style>
248
+ </head>
249
+ <body>
250
+
251
+ <header>
252
+ <div class="logo-block">
253
+ <span class="logo-title">WASM_U Performance Record</span>
254
+ <div id="status-badge" class="badge loading">WASM INITIALIZING</div>
255
+ </div>
256
+ <div>
257
+ <span style="font-size: 0.85rem; color: var(--text-muted);">Isomorphic Parity Test Sandbox</span>
258
+ </div>
259
+ </header>
260
+
261
+ <main>
262
+ <!-- Left Panel: Input & Telemetry -->
263
+ <div class="panel">
264
+ <h2>1. Mapped Intent Coordinates (Cuneiform-U)</h2>
265
+ <p style="font-size: 0.85rem; color: var(--text-muted);">
266
+ Paste or modify the 6D concept coordinate mapping array below. Each concept maps to a radical tuple (domain, subdomain, operation, modality, depth, polarity).
267
+ </p>
268
+ <textarea id="coords-input">[
269
+ {"domain": 1, "subdomain": 2, "operation": 3, "modality": 4, "depth": 5, "polarity": 6},
270
+ {"domain": 8, "subdomain": 0, "operation": 15, "modality": 1, "depth": 0, "polarity": 15},
271
+ {"domain": 0, "subdomain": 0, "operation": 0, "modality": 0, "depth": 0, "polarity": 0},
272
+ {"domain": 15, "subdomain": 15, "operation": 15, "modality": 15, "depth": 15, "polarity": 15},
273
+ {"domain": 4, "subdomain": 5, "operation": 6, "modality": 7, "depth": 8, "polarity": 9}
274
+ ]</textarea>
275
+
276
+ <div class="button-group">
277
+ <button id="btn-validate">Run Parity check</button>
278
+ <button id="btn-bench" class="btn-accent">Run 10,000x loops benchmark</button>
279
+ </div>
280
+
281
+ <div class="results-block">
282
+ <div class="result-row">
283
+ <span>Verification Status:</span>
284
+ <span id="verif-status" class="result-val">Not Run</span>
285
+ </div>
286
+ <div class="result-row">
287
+ <span>Compressed Payload:</span>
288
+ <span id="compressed-size" class="result-val">-</span>
289
+ </div>
290
+ <div class="result-row">
291
+ <span>Warm Execution Latency (1 Iteration):</span>
292
+ <span id="single-latency" class="result-val">-</span>
293
+ </div>
294
+ <div class="result-row">
295
+ <span>Average Benchmark Latency:</span>
296
+ <span id="avg-latency" class="result-val highlight">-</span>
297
+ </div>
298
+ </div>
299
+ </div>
300
+
301
+ <!-- Right Panel: Visualizations & Logs -->
302
+ <div class="panel">
303
+ <h2>2. 6D Semantic Hypercube Coordinate Cloud</h2>
304
+ <div class="visualizer-container">
305
+ <canvas id="cube-canvas"></canvas>
306
+ </div>
307
+
308
+ <h2>3. Log Console output</h2>
309
+ <div id="logs" class="logs-container">
310
+ <div>[SYSTEM] Waiting for WASM compile initialization...</div>
311
+ </div>
312
+ </div>
313
+ </main>
314
+
315
+ <footer>
316
+ <p>© 2026 Zymatica.space &bull; astronautshe.com &bull; The AI Collective ART. Freestanding Zig target compiled natively inside VRAM/Cache.</p>
317
+ </footer>
318
+
319
+ <script>
320
+ let wasmExports = null;
321
+ let memoryBuffer = null;
322
+
323
+ // Log handler
324
+ function logMsg(msg, color = "#48BB78") {
325
+ const consoleDiv = document.getElementById('logs');
326
+ const newLog = document.createElement('div');
327
+ newLog.style.color = color;
328
+ newLog.innerText = msg;
329
+ consoleDiv.appendChild(newLog);
330
+ consoleDiv.scrollTop = consoleDiv.scrollHeight;
331
+ }
332
+
333
+ // WebAssembly instantiation
334
+ async function loadWasm() {
335
+ try {
336
+ const response = await fetch('proof_wasm.wasm');
337
+ if (!response.ok) {
338
+ throw new Error("Could not fetch proof_wasm.wasm");
339
+ }
340
+ const buffer = await response.arrayBuffer();
341
+ const wasmObj = await WebAssembly.instantiate(buffer);
342
+ wasmExports = wasmObj.instance.exports;
343
+ memoryBuffer = wasmExports.memory;
344
+
345
+ logMsg("[+] proof_wasm.wasm loaded and instanced successfully!");
346
+ document.getElementById('status-badge').innerText = "WASM READY";
347
+ document.getElementById('status-badge').className = "badge ready";
348
+
349
+ // Trigger verification check
350
+ const verifResult = wasmExports.run_verification();
351
+ if (verifResult === 1) {
352
+ logMsg("[+] Core freestanding verification test returned: 1 (SUCCESS)", "#48BB78");
353
+ } else {
354
+ logMsg("[-] Core freestanding verification test returned: 0 (FAILURE)", "#F56565");
355
+ }
356
+ } catch (e) {
357
+ logMsg("[-] Error compiling WASM: " + e.message, "#F56565");
358
+ document.getElementById('status-badge').innerText = "WASM ERROR";
359
+ document.getElementById('status-badge').className = "badge loading";
360
+ }
361
+ }
362
+
363
+ // Run verification parity loop
364
+ document.getElementById('btn-validate').addEventListener('click', () => {
365
+ if (!wasmExports) {
366
+ logMsg("[-] WebAssembly is not initialized yet.", "#F56565");
367
+ return;
368
+ }
369
+
370
+ try {
371
+ const inputJson = JSON.parse(document.getElementById('coords-input').value);
372
+ const count = inputJson.length;
373
+ logMsg(`[+] Triggering coordinate validation check on ${count} elements...`);
374
+
375
+ const structSize = 6;
376
+ const inputOffset = 102400; // Offset in WASM memory
377
+ const memView = new Uint8Array(memoryBuffer.buffer);
378
+
379
+ // Write coordinates to WASM memory
380
+ for (let i = 0; i < count; i++) {
381
+ const idx = inputOffset + i * structSize;
382
+ const c = inputJson[i];
383
+ memView[idx] = c.domain;
384
+ memView[idx + 1] = c.subdomain;
385
+ memView[idx + 2] = c.operation;
386
+ memView[idx + 3] = c.modality;
387
+ memView[idx + 4] = c.depth;
388
+ memView[idx + 5] = c.polarity;
389
+ }
390
+
391
+ const t0 = performance.now();
392
+ const encodedBufferPtr = wasmExports.wasm_encode(inputOffset, count);
393
+ const bitsCount = wasmExports.wasm_get_encoded_bits();
394
+ const bytesCount = Math.floor((bitsCount + 7) / 8);
395
+ const t1 = performance.now();
396
+
397
+ logMsg(` - Encoded size: ${bitsCount} bits (${bytesCount} bytes)`);
398
+ document.getElementById('compressed-size').innerText = `${bytesCount} Bytes (${bitsCount} bits)`;
399
+
400
+ // Decode
401
+ const decodedBufferPtr = wasmExports.wasm_decode(encodedBufferPtr, bytesCount, count);
402
+ const decodedView = new Uint8Array(memoryBuffer.buffer, decodedBufferPtr, count * structSize);
403
+
404
+ let matches = true;
405
+ for (let i = 0; i < count; i++) {
406
+ const idx = i * structSize;
407
+ const orig = inputJson[i];
408
+ const dec = {
409
+ domain: decodedView[idx],
410
+ subdomain: decodedView[idx + 1],
411
+ operation: decodedView[idx + 2],
412
+ modality: decodedView[idx + 3],
413
+ depth: decodedView[idx + 4],
414
+ polarity: decodedView[idx + 5]
415
+ };
416
+
417
+ if (orig.domain !== dec.domain || orig.subdomain !== dec.subdomain ||
418
+ orig.operation !== dec.operation || orig.modality !== dec.modality ||
419
+ orig.depth !== dec.depth || orig.polarity !== dec.polarity) {
420
+ matches = false;
421
+ logMsg(` [-] Parity mismatch at coordinate index ${i}!`, "#F56565");
422
+ break;
423
+ }
424
+ }
425
+
426
+ if (matches) {
427
+ logMsg(`[+] Lossless Parity Status: 1 (SUCCESS). Decoded elements match input perfectly.`, "#48BB78");
428
+ document.getElementById('verif-status').innerText = "PASSED (100% PARITY)";
429
+ document.getElementById('verif-status').style.color = "#48BB78";
430
+ } else {
431
+ document.getElementById('verif-status').innerText = "FAILED";
432
+ document.getElementById('verif-status').style.color = "#F56565";
433
+ }
434
+
435
+ const singleLat = t1 - t0;
436
+ document.getElementById('single-latency').innerText = `${singleLat.toFixed(5)} ms (${(singleLat * 1000).toFixed(2)} us)`;
437
+
438
+ } catch (err) {
439
+ logMsg("[-] Execution Error: " + err.message, "#F56565");
440
+ }
441
+ });
442
+
443
+ // Run warm JIT benchmark loops
444
+ document.getElementById('btn-bench').addEventListener('click', () => {
445
+ if (!wasmExports) {
446
+ logMsg("[-] WebAssembly is not initialized yet.", "#F56565");
447
+ return;
448
+ }
449
+
450
+ logMsg("[+] Starting Warm CPU Cache JIT benchmark loop (10,000 runs)...");
451
+ const loops = 10000;
452
+ const t0 = performance.now();
453
+ for (let i = 0; i < loops; i++) {
454
+ wasmExports.run_verification();
455
+ }
456
+ const t1 = performance.now();
457
+
458
+ const durationMs = t1 - t0;
459
+ const avgMs = durationMs / loops;
460
+ const avgUs = avgMs * 1000;
461
+
462
+ logMsg(`[+] Warm benchmark finished: Total = ${durationMs.toFixed(3)} ms, Avg = ${avgUs.toFixed(4)} microseconds per loop.`, "#48BB78");
463
+ document.getElementById('avg-latency').innerText = `${avgUs.toFixed(4)} Microseconds`;
464
+ document.getElementById('avg-latency').style.color = "#48BB78";
465
+
466
+ // Adjust visualizer rotation speed based on speed
467
+ rotSpeed = 0.05;
468
+ });
469
+
470
+ // --- Canvas Rotating Cloud Visualizer ---
471
+ const canvas = document.getElementById('cube-canvas');
472
+ const ctx = canvas.getContext('2d');
473
+
474
+ let rotX = 0;
475
+ let rotY = 0;
476
+ let rotSpeed = 0.005;
477
+
478
+ // Resize handler
479
+ function resizeCanvas() {
480
+ canvas.width = canvas.parentElement.clientWidth;
481
+ canvas.height = canvas.parentElement.clientHeight;
482
+ }
483
+ window.addEventListener('resize', resizeCanvas);
484
+ resizeCanvas();
485
+
486
+ // 3D coordinate projection
487
+ function project3D(x, y, z, width, height) {
488
+ const fov = 350;
489
+ const distance = 400;
490
+ const scale = fov / (distance + z);
491
+ const x2d = width / 2 + x * scale;
492
+ const y2d = height / 2 + y * scale;
493
+ return { x: x2d, y: y2d, scale: scale };
494
+ }
495
+
496
+ // Generate points on hypercube coordinates
497
+ const points = [];
498
+ for (let i = 0; i < 64; i++) {
499
+ points.push({
500
+ x: ((i & 1) ? 100 : -100) + (Math.random() - 0.5) * 20,
501
+ y: ((i & 2) ? 100 : -100) + (Math.random() - 0.5) * 20,
502
+ z: ((i & 4) ? 100 : -100) + (Math.random() - 0.5) * 20,
503
+ col: (i % 2 === 0) ? '#63B3ED' : '#D6BCFA'
504
+ });
505
+ }
506
+
507
+ function drawVisualizer() {
508
+ ctx.clearRect(0, 0, canvas.width, canvas.height);
509
+
510
+ rotX += rotSpeed;
511
+ rotY += rotSpeed * 0.7;
512
+
513
+ const cosX = Math.cos(rotX);
514
+ const sinX = Math.sin(rotX);
515
+ const cosY = Math.cos(rotY);
516
+ const sinY = Math.sin(rotY);
517
+
518
+ // Draw bounding circular grid
519
+ ctx.strokeStyle = 'rgba(99, 179, 237, 0.05)';
520
+ ctx.lineWidth = 1;
521
+ ctx.beginPath();
522
+ ctx.arc(canvas.width / 2, canvas.height / 2, 120, 0, Math.PI * 2);
523
+ ctx.stroke();
524
+
525
+ // Draw coordinate axis lines
526
+ ctx.beginPath();
527
+ ctx.moveTo(canvas.width / 2 - 140, canvas.height / 2);
528
+ ctx.lineTo(canvas.width / 2 + 140, canvas.height / 2);
529
+ ctx.moveTo(canvas.width / 2, canvas.height / 2 - 140);
530
+ ctx.lineTo(canvas.width / 2, canvas.height / 2 + 140);
531
+ ctx.stroke();
532
+
533
+ // Render projected coordinates points
534
+ const projected = points.map(p => {
535
+ // Rotation X
536
+ let y1 = p.y * cosX - p.z * sinX;
537
+ let z1 = p.z * cosX + p.y * sinX;
538
+
539
+ // Rotation Y
540
+ let x2 = p.x * cosY - z1 * sinY;
541
+ let z2 = z1 * cosY + p.x * sinY;
542
+
543
+ const proj = project3D(x2, y1, z2, canvas.width, canvas.height);
544
+ return { ...proj, col: p.col };
545
+ });
546
+
547
+ // Draw connecting web lines (simulating neural prior connection matrix)
548
+ ctx.lineWidth = 0.5;
549
+ for (let i = 0; i < projected.length; i++) {
550
+ for (let j = i + 1; j < projected.length; j++) {
551
+ const dx = projected[i].x - projected[j].x;
552
+ const dy = projected[i].y - projected[j].y;
553
+ const dist = Math.sqrt(dx*dx + dy*dy);
554
+ if (dist < 45) {
555
+ ctx.strokeStyle = `rgba(99, 179, 237, ${0.15 * (1 - dist/45)})`;
556
+ ctx.beginPath();
557
+ ctx.moveTo(projected[i].x, projected[i].y);
558
+ ctx.lineTo(projected[j].x, projected[j].y);
559
+ ctx.stroke();
560
+ }
561
+ }
562
+ }
563
+
564
+ // Draw coordinate node spheres
565
+ projected.forEach(p => {
566
+ ctx.fillStyle = p.col;
567
+ ctx.beginPath();
568
+ ctx.arc(p.x, p.y, Math.max(1, p.scale * 2.5), 0, Math.PI * 2);
569
+ ctx.fill();
570
+ });
571
+
572
+ if (rotSpeed > 0.005) {
573
+ rotSpeed -= 0.001; // Decay speed boost back to base rotation rate
574
+ }
575
+
576
+ requestAnimationFrame(drawVisualizer);
577
+ }
578
+
579
+ // Initialize Page
580
+ window.addEventListener('load', () => {
581
+ loadWasm();
582
+ drawVisualizer();
583
+ });
584
+ </script>
585
+ </body>
586
+ </html>