sjhallo07 commited on
Commit
c05247a
·
verified ·
1 Parent(s): 8cc1449

Upload gemini-code-barridofull.html

Browse files
Files changed (1) hide show
  1. gemini-code-barridofull.html +1019 -0
gemini-code-barridofull.html ADDED
@@ -0,0 +1,1019 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="es">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Null Fock Theory & Relatividad Algebraica 26D - Secuencia Vectorial y Reversal</title>
7
+ <!-- Three.js y OrbitControls desde CDN -->
8
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js"></script>
9
+ <script src="https://cdn.jsdelivr.net/npm/three@0.128.0/examples/js/controls/OrbitControls.js"></script>
10
+ <style>
11
+ * { box-sizing: border-box; }
12
+ body {
13
+ margin: 0;
14
+ overflow: hidden;
15
+ background-color: #02040a;
16
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
17
+ color: #e2e8f0;
18
+ }
19
+ #canvas-container {
20
+ width: 100vw;
21
+ height: 100vh;
22
+ display: block;
23
+ }
24
+ .hud-panel {
25
+ position: absolute;
26
+ background: rgba(15, 23, 42, 0.92);
27
+ border: 1px solid rgba(56, 189, 248, 0.3);
28
+ backdrop-filter: blur(12px);
29
+ padding: 12px 16px;
30
+ border-radius: 10px;
31
+ box-shadow: 0 10px 30px rgba(0,0,0,0.8);
32
+ z-index: 10;
33
+ }
34
+ #header-panel {
35
+ top: 10px; left: 10px; right: 10px;
36
+ display: flex; justify-content: space-between; align-items: center;
37
+ }
38
+ #control-panel {
39
+ top: 70px; left: 10px;
40
+ width: 380px; max-height: calc(100vh - 85px);
41
+ overflow-y: auto;
42
+ }
43
+ #right-top-panel {
44
+ top: 70px; right: 10px;
45
+ width: 360px;
46
+ }
47
+ #right-bottom-panel {
48
+ bottom: 10px; right: 10px;
49
+ width: 400px; max-height: 220px; overflow: auto;
50
+ }
51
+ h1 { font-size: 1rem; color: #38bdf8; margin: 0; }
52
+ .subtitle { font-size: 0.7rem; color: #94a3b8; margin-top: 2px; }
53
+ .control-group { margin-bottom: 10px; }
54
+ label { display: flex; justify-content: space-between; font-size: 0.72rem; color: #38bdf8; margin-bottom: 3px; }
55
+ select, input[type=range], button { width: 100%; }
56
+ select {
57
+ background: #030712; color: #00f0ff; border: 1px solid rgba(0, 240, 255, 0.4);
58
+ padding: 6px; border-radius: 6px; font-size: 0.75rem; margin-top: 2px;
59
+ }
60
+ input[type=range] { accent-color: #0ea5e9; cursor: pointer; }
61
+ .btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
62
+ button {
63
+ background: #0284c7; color: white; border: none; padding: 7px;
64
+ border-radius: 6px; font-size: 0.7rem; font-weight: bold; cursor: pointer;
65
+ transition: background 0.2s, transform 0.1s;
66
+ }
67
+ button:hover { background: #0ea5e9; }
68
+ button.secondary { background: #334155; }
69
+ button.secondary:hover { background: #475569; }
70
+ .btn-dirac { background: #7c2d12; border: 1px solid #f97316; color: #ffedd5; }
71
+ .btn-dirac:hover { background: #9a3412; }
72
+ .btn-fock { background: #1e3a8a; border: 1px solid #3b82f6; color: #bfdbfe; }
73
+ .btn-fock:hover { background: #1d4ed8; }
74
+ .btn-vector { background: #065f46; border: 1px solid #10b981; color: #d1fae5; }
75
+ .btn-vector:hover { background: #047857; }
76
+ .btn-seq-forward { background: #0284c7; border: 1px solid #38bdf8; color: #e0f2fe; }
77
+ .btn-seq-forward:hover { background: #0369a1; }
78
+ .btn-seq-reversal { background: #be123c; border: 1px solid #f43f5e; color: #ffe4e6; }
79
+ .btn-seq-reversal:hover { background: #9f1239; }
80
+
81
+ .stats-panel {
82
+ font-size: 0.72rem; background: rgba(3, 7, 18, 0.95);
83
+ padding: 8px 10px; border-radius: 6px; border: 1px solid #1e293b; margin-top: 8px;
84
+ }
85
+ .stat-row { display: flex; justify-content: space-between; margin-bottom: 3px; }
86
+ .dim-highlight { color: #fbbf24; font-weight: bold; }
87
+ .matter-val { color: #38bdf8; font-weight: bold; }
88
+ .antimatter-val { color: #f43f5e; font-weight: bold; }
89
+ .fock-val { color: #22c55e; font-weight: bold; }
90
+
91
+ #algebra-log {
92
+ font-family: monospace; font-size: 0.68rem; color: #38bdf8;
93
+ background: rgba(2, 6, 23, 0.95); padding: 8px; border-radius: 6px;
94
+ border: 1px solid #1e293b; margin-bottom: 8px; max-height: 90px; overflow-y: auto;
95
+ }
96
+ canvas.chart-canvas { width: 100%; height: 70px; background: rgba(0,0,0,0.5); border-radius: 4px; margin-top: 4px; }
97
+ table.matrix-table { width: 100%; border-collapse: collapse; color: #a5f3fc; font-family: monospace; font-size: 0.65rem; }
98
+ table.matrix-table td { padding: 2px; text-align: center; border: 1px solid rgba(0, 240, 255, 0.15); }
99
+ .status-badge { font-size: 0.7rem; font-weight: bold; padding: 3px 8px; border-radius: 4px; background: rgba(0,240,255,0.1); }
100
+
101
+ .vector-container {
102
+ margin-top: 10px;
103
+ background: rgba(3, 7, 18, 0.95);
104
+ padding: 8px;
105
+ border-radius: 6px;
106
+ border: 1px solid #1e293b;
107
+ }
108
+ canvas.vector-canvas {
109
+ width: 100%;
110
+ height: 190px;
111
+ background: #020617;
112
+ border-radius: 4px;
113
+ display: block;
114
+ }
115
+ </style>
116
+ </head>
117
+ <body>
118
+
119
+ <div id="canvas-container"></div>
120
+
121
+ <!-- ENCABEZADO SUPERIOR -->
122
+ <div id="header-panel" class="hud-panel">
123
+ <div>
124
+ <h1>Null Fock & Relatividad Algebraica: Matriz Fuente &rho;₂₆_D⁽²⁾</h1>
125
+ <div class="subtitle">Modelo Hiperdimensional | Secuencia Vectorial ONDAR 5D-26D & Reversal 26D $\rightarrow$ 1D = 0</div>
126
+ </div>
127
+ <div>
128
+ <span id="status-badge" class="status-badge" style="color: #f59e0b;">Fase: Telemetría Activa</span>
129
+ </div>
130
+ </div>
131
+
132
+ <!-- PANEL DE CONTROL IZQUIERDO -->
133
+ <div id="control-panel" class="hud-panel">
134
+ <div class="control-group">
135
+ <label><span>Estadio Dimensional Dinámico:</span></label>
136
+ <select id="menu-dim" onchange="cambiarDimensionManual(this.value)">
137
+ <option value="1D">1D - Punto Singularity / Nulo (1x1)</option>
138
+ <option value="5D">5D - Matriz Factorial Reducida</option>
139
+ <option value="11D">11D - Cavidad Ceros de Riemann</option>
140
+ <option value="15D">15D - Transición Topológica</option>
141
+ <option value="26D" selected>26D - Matriz Fuente Plena &rho;₂₆_D⁽²⁾</option>
142
+ </select>
143
+ </div>
144
+
145
+ <div class="control-group">
146
+ <label>
147
+ <span>Parámetro Secuencial (r):</span>
148
+ <span id="lblValR">0.000</span>
149
+ </label>
150
+ <input type="range" id="rangeSweep" min="-0.5" max="0.0" step="0.001" value="0.0">
151
+ </div>
152
+
153
+ <!-- MACRO-SECUENCIAS VECTORIALES -->
154
+ <div style="font-size:0.7rem; font-weight:bold; color:#00f0ff; margin-top:8px; margin-bottom:4px;">
155
+ Macro-Secuencias de Onda y Vector:
156
+ </div>
157
+ <div class="btn-grid">
158
+ <button class="btn-seq-forward" onclick="iniciarSecuenciaForward()">▶ Secuencia 5D → 26D</button>
159
+ <button class="btn-seq-reversal" onclick="iniciarSecuenciaReversal()">◀ Reversal 26D → 1D = 0</button>
160
+ </div>
161
+
162
+ <div class="btn-grid" style="margin-top: 6px;">
163
+ <button id="btnAuto">Barrido r (Auto)</button>
164
+ <button id="btnReset" class="secondary">Reiniciar Todo</button>
165
+ </div>
166
+
167
+ <div style="margin-top: 10px;" class="control-group">
168
+ <button class="btn-dirac" onclick="ejecutarDiracCero()">1. Anular Campo Dirac (Dirac = 0)</button>
169
+ <button class="btn-fock" onclick="ejecutarFusionFock()" style="margin-top: 4px;">2. Fusionar con Espacio de Fock</button>
170
+ <button class="btn-vector" onclick="ejecutarAlgebraNoLineal()" style="margin-top: 4px;">3. Ejecutar Álgebra No Lineal f(&rho;)</button>
171
+ <button onclick="toggleRotacionAutomatica()" class="secondary" style="margin-top: 4px;">⚡ Conmutar Giro 3D</button>
172
+ </div>
173
+
174
+ <div class="stats-panel">
175
+ <div class="stat-row">
176
+ <span>Estado Dimensional:</span>
177
+ <span id="valDim" class="dim-highlight">26D - Cierre Bosónico</span>
178
+ </div>
179
+ <div class="stat-row">
180
+ <span>Energía Materia (&cosh;):</span>
181
+ <span id="valMatter" class="matter-val">1.2517</span>
182
+ </div>
183
+ <div class="stat-row">
184
+ <span>Energía Antimateria (&sinh;):</span>
185
+ <span id="valAntimatter" class="antimatter-val">1.0278</span>
186
+ </div>
187
+ <div class="stat-row">
188
+ <span>Campo de Fock (F):</span>
189
+ <span id="valFock" class="fock-val">Equilibrio Dinámico</span>
190
+ </div>
191
+ </div>
192
+
193
+ <!-- ANALIZADOR VECTORIAL POLAR -->
194
+ <div class="vector-container">
195
+ <div style="font-weight:bold; font-size: 0.72rem; color:#38bdf8; display:flex; justify-content:space-between; margin-bottom: 4px;">
196
+ <span>Analizador Vectorial Fasorial</span>
197
+ <span style="color: #00f0ff;" id="vector-hud-tag">26 Canales</span>
198
+ </div>
199
+ <canvas id="vectorCanvas26" class="vector-canvas"></canvas>
200
+ <div style="font-size: 0.63rem; color: #94a3b8; margin-top: 4px; display: flex; justify-content: space-between;">
201
+ <span style="color: #38bdf8;">■ Par: Materia (&cosh;)</span>
202
+ <span style="color: #f43f5e;">■ Impar: Antimateria (&sinh;)</span>
203
+ </div>
204
+ </div>
205
+ </div>
206
+
207
+ <!-- PANEL DERECHO SUPERIOR -->
208
+ <div id="right-top-panel" class="hud-panel">
209
+ <div style="font-weight:bold; font-size: 0.75rem; color:#fff; margin-bottom:4px; border-bottom: 1px solid rgba(0,240,255,0.2); padding-bottom:2px;">
210
+ Telemetría Analítica:
211
+ </div>
212
+ <div id="algebra-log">[Bob-Node-26D] Matriz Fuente &rho;₂₆_D⁽²⁾ cargada correctamente.</div>
213
+
214
+ <div style="font-weight:bold; font-size: 0.72rem; color:#fff; display:flex; justify-content:space-between; margin-top: 6px;">
215
+ <span>Espacio de Fase & Frecuencia Matriz</span>
216
+ <span style="color: #00f0ff;" id="chart-tag">Freq: -- Hz</span>
217
+ </div>
218
+ <canvas id="spectralChart" class="chart-canvas"></canvas>
219
+ </div>
220
+
221
+ <!-- PANEL DERECHO INFERIOR -->
222
+ <div id="right-bottom-panel" class="hud-panel">
223
+ <div style="font-weight:bold; margin-bottom:4px; color:#fff; display:flex; justify-content:space-between; font-size: 0.75rem;">
224
+ <span id="hud-title">Inspección Factorial Fuente (26D)</span>
225
+ <span style="color: #00f0ff;" id="hud-dim-tag">26x26 Grid</span>
226
+ </div>
227
+ <table class="matrix-table" id="matrix-grid"></table>
228
+ </div>
229
+
230
+ <script>
231
+ // --- 1. CONFIGURACIÓN Y TELEMETRÍA ---
232
+ const TELEMETRY_CONFIG = {
233
+ globalEnergyInvariant: 3.5189,
234
+ harmonicConstant: 7,
235
+ targetNode: "Bob-Node-26D"
236
+ };
237
+
238
+ let currentDimSize = 26;
239
+ let selectedDimKey = '26D';
240
+ let pipelinePhase = 'PREVIEW';
241
+ let isAutoRotating = true;
242
+ let isAutoSweep = false;
243
+ let autoSweepDir = 1;
244
+ let matrixStates = [];
245
+
246
+ // Modos de secuencia vectorial automatizada
247
+ let autoSequenceMode = 'NONE'; // 'FORWARD_5D_26D', 'REVERSAL_26D_1D'
248
+ let sequenceProgress = 0;
249
+ let reversalZeroFactor = 1.0; // Factor de atenuación al colapsar a 1D = 0
250
+
251
+ const channelFrequencies = new Float32Array(26);
252
+
253
+ function calcularFactorial(n) {
254
+ if (n === 0 || n === 1) return 1;
255
+ let res = 1;
256
+ for (let i = 2; i <= n; i++) res *= i;
257
+ return res;
258
+ }
259
+
260
+ function generarMatrizFactorialReal(size) {
261
+ let matrizReal = [];
262
+ for (let i = 0; i < size; i++) {
263
+ let fila = [];
264
+ for (let j = 0; j < size; j++) {
265
+ if ((i + j) % 2 === 0) {
266
+ let f1 = calcularFactorial(i);
267
+ let f2 = calcularFactorial(j);
268
+ fila.push(1.0 / (f1 * f2));
269
+ } else {
270
+ fila.push(0.0);
271
+ }
272
+ }
273
+ matrizReal.push(fila);
274
+ }
275
+ return matrizReal;
276
+ }
277
+
278
+ function generarMatrizHTML(size) {
279
+ const matrizData = generarMatrizFactorialReal(size);
280
+ const tabla = document.getElementById('matrix-grid');
281
+ let html = '';
282
+ for (let i = 0; i < size; i++) {
283
+ html += '<tr>';
284
+ for (let j = 0; j < size; j++) {
285
+ let val = matrizData[i][j];
286
+ let displayVal = val === 0 ? "0" : (val === 1 ? "1" : `1/${i === 0 ? 1 : i + '!'}${j === 0 ? 1 : j + '!'}`);
287
+ if (size > 12) {
288
+ displayVal = val === 0 ? "0" : val.toExponential(0);
289
+ }
290
+ html += `<td>${displayVal}</td>`;
291
+ }
292
+ html += '</tr>';
293
+ }
294
+ tabla.innerHTML = html;
295
+ }
296
+
297
+ // --- 2. ESCENA WEBGL CON THREE.JS ---
298
+ const container = document.getElementById('canvas-container');
299
+ const scene = new THREE.Scene();
300
+ scene.background = new THREE.Color(0x02040a);
301
+ scene.fog = new THREE.FogExp2(0x02040a, 0.015);
302
+
303
+ const camera = new THREE.PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 1000);
304
+ camera.position.set(26, 26, 34);
305
+
306
+ const renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
307
+ renderer.setSize(window.innerWidth, window.innerHeight);
308
+ renderer.setPixelRatio(window.devicePixelRatio);
309
+ container.appendChild(renderer.domElement);
310
+
311
+ const controls = new THREE.OrbitControls(camera, renderer.domElement);
312
+ controls.enableDamping = true;
313
+ controls.dampingFactor = 0.05;
314
+
315
+ // Iluminación
316
+ scene.add(new THREE.AmbientLight(0xffffff, 0.75));
317
+ const lightA = new THREE.PointLight(0x38bdf8, 2, 60);
318
+ lightA.position.set(-12, 22, 12);
319
+ scene.add(lightA);
320
+
321
+ const lightB = new THREE.PointLight(0xf43f5e, 2, 60);
322
+ lightB.position.set(12, 22, -12);
323
+ scene.add(lightB);
324
+
325
+ const gridHelper = new THREE.GridHelper(36, 18, 0x38bdf8, 0x1e293b);
326
+ gridHelper.position.y = -3.4;
327
+ scene.add(gridHelper);
328
+
329
+ const master3DGroup = new THREE.Group();
330
+ scene.add(master3DGroup);
331
+
332
+ let matrixGroup = new THREE.Group();
333
+ let stringsGroup = new THREE.Group();
334
+ let channelsGroup = new THREE.Group();
335
+ master3DGroup.add(matrixGroup);
336
+ master3DGroup.add(stringsGroup);
337
+ master3DGroup.add(channelsGroup);
338
+
339
+ // --- 3. RECONSTRUCCIÓN DINÁMICA DE LA RETÍCULA 3D ---
340
+ function reconstruirEscena3D(size) {
341
+ while(matrixGroup.children.length > 0) matrixGroup.remove(matrixGroup.children[0]);
342
+ while(stringsGroup.children.length > 0) stringsGroup.remove(stringsGroup.children[0]);
343
+ while(channelsGroup.children.length > 0) channelsGroup.remove(channelsGroup.children[0]);
344
+
345
+ const matrizData = generarMatrizFactorialReal(size);
346
+ const scaleFactor = Math.max(size, 4);
347
+ const barGeo = new THREE.BoxGeometry(0.55 * (22/scaleFactor), 1, 0.55 * (22/scaleFactor));
348
+ barGeo.translate(0, 0.5, 0);
349
+
350
+ matrixStates = [];
351
+
352
+ for (let i = 0; i < size; i++) {
353
+ for (let j = 0; j < size; j++) {
354
+ let densidad = matrizData[i][j];
355
+ let isEven = (i + j) % 2 === 0;
356
+ let baseH = isEven ? Math.max(0.15, Math.log10(1 / (densidad + 1e-12) + 1) * 0.35) : 0.05;
357
+ if (i === j) baseH *= 1.3;
358
+
359
+ let colorMat = i === j ? 0xffb703 : (isEven ? 0x38bdf8 : 0xf43f5e);
360
+ let material = new THREE.MeshStandardMaterial({
361
+ color: colorMat,
362
+ roughness: 0.25,
363
+ metalness: 0.75,
364
+ emissive: colorMat,
365
+ emissiveIntensity: 0.2
366
+ });
367
+
368
+ let mesh = new THREE.Mesh(barGeo, material);
369
+ let posX = (i - size / 2 + 0.5) * (22 / scaleFactor);
370
+ let posZ = (j - size / 2 + 0.5) * (22 / scaleFactor);
371
+ mesh.position.set(posX, -3.2, posZ);
372
+
373
+ mesh.userData = {
374
+ isEven: isEven,
375
+ baseX: posX,
376
+ baseZ: posZ,
377
+ baseHeight: baseH,
378
+ density: densidad,
379
+ indexI: i,
380
+ indexJ: j,
381
+ phase: Math.random() * Math.PI
382
+ };
383
+
384
+ matrixGroup.add(mesh);
385
+ matrixStates.push(mesh);
386
+
387
+ // Conexión canal diagonal
388
+ if (i === j && i < size - 1) {
389
+ let nextPosX = ((i+1) - size/2 + 0.5) * (22/scaleFactor);
390
+ let nextPosZ = ((j+1) - size/2 + 0.5) * (22/scaleFactor);
391
+ let geomLine = new THREE.BufferGeometry().setFromPoints([
392
+ new THREE.Vector3(posX, -3.1, posZ),
393
+ new THREE.Vector3(nextPosX, -3.1, nextPosZ)
394
+ ]);
395
+ let lineMat = new THREE.LineBasicMaterial({ color: 0xffb703, linewidth: 2 });
396
+ channelsGroup.add(new THREE.Line(geomLine, lineMat));
397
+ }
398
+ }
399
+ }
400
+
401
+ // Cuerdas de solitones
402
+ const stringMat = new THREE.LineBasicMaterial({ color: 0xf43f5e, linewidth: 2 });
403
+ let stringCount = Math.max(1, Math.min(size, 12));
404
+ for (let s = 0; s < stringCount; s++) {
405
+ let points = [];
406
+ let zCoord = (s - size/2) * (18 / size);
407
+ for (let p = -10; p <= 10; p += 1) {
408
+ points.push(new THREE.Vector3(p, Math.sin(p * 0.4 + s) * 0.8, zCoord));
409
+ }
410
+ let stringGeom = new THREE.BufferGeometry().setFromPoints(points);
411
+ stringsGroup.add(new THREE.Line(stringGeom, stringMat));
412
+ }
413
+ }
414
+
415
+ // --- 4. SUPERFICIE ONDAS ZETA DE RIEMANN ---
416
+ const zetaGeo = new THREE.PlaneGeometry(24, 24, 36, 36);
417
+ zetaGeo.rotateX(-Math.PI / 2);
418
+ const zetaPosAttr = zetaGeo.attributes.position;
419
+ const nonTrivialZeros = [14.1347, 21.0220, 25.0110, 30.4249, 32.9351];
420
+
421
+ function updateZetaWave(r) {
422
+ for (let k = 0; k < zetaPosAttr.count; k++) {
423
+ let x = zetaPosAttr.getX(k);
424
+ let z = zetaPosAttr.getZ(k);
425
+ let reS = x / 4;
426
+ let imS = Math.abs(z / 1.2) + 2;
427
+
428
+ let waveBase = Math.cos(reS * 2 + r * 5) * 0.5;
429
+ let zeroPull = 0;
430
+ nonTrivialZeros.forEach(zeroIm => {
431
+ let dist = Math.sqrt(Math.pow(reS - 0.5, 2) + Math.pow(imS - zeroIm * 0.4, 2));
432
+ zeroPull += 2.5 / (1.0 + Math.pow(dist * 3, 2));
433
+ });
434
+ let y = (waveBase - zeroPull) * (1.0 + Math.abs(r)) * reversalZeroFactor;
435
+ zetaPosAttr.setY(k, y - 0.5);
436
+ }
437
+ zetaPosAttr.needsUpdate = true;
438
+ }
439
+
440
+ const zetaMaterial = new THREE.MeshStandardMaterial({
441
+ color: 0x22d3ee,
442
+ wireframe: true,
443
+ transparent: true,
444
+ opacity: 0.35,
445
+ side: THREE.DoubleSide
446
+ });
447
+ const zetaMesh = new THREE.Mesh(zetaGeo, zetaMaterial);
448
+ master3DGroup.add(zetaMesh);
449
+
450
+ // --- 5. TEXTURA CANVAS 2D MATRIZ EN EL SUELO INFERIOR ---
451
+ const floorCanvas = document.createElement('canvas');
452
+ floorCanvas.width = 2048;
453
+ floorCanvas.height = 2048;
454
+ const ctxFloor = floorCanvas.getContext('2d');
455
+
456
+ const floorTexture = new THREE.CanvasTexture(floorCanvas);
457
+ const floorGeo = new THREE.PlaneGeometry(26, 26);
458
+ floorGeo.rotateX(-Math.PI / 2);
459
+
460
+ const floorMat = new THREE.MeshBasicMaterial({
461
+ map: floorTexture,
462
+ transparent: true,
463
+ opacity: 0.85,
464
+ side: THREE.DoubleSide
465
+ });
466
+
467
+ const floorMesh = new THREE.Mesh(floorGeo, floorMat);
468
+ floorMesh.position.y = -3.48;
469
+ master3DGroup.add(floorMesh);
470
+
471
+ function drawNumericMatrix(r) {
472
+ ctxFloor.clearRect(0, 0, 2048, 2048);
473
+ ctxFloor.fillStyle = 'rgba(3, 7, 18, 0.95)';
474
+ ctxFloor.fillRect(0, 0, 2048, 2048);
475
+
476
+ ctxFloor.strokeStyle = '#1e293b';
477
+ ctxFloor.lineWidth = 4;
478
+ ctxFloor.strokeRect(20, 20, 2008, 2008);
479
+
480
+ ctxFloor.fillStyle = '#38bdf8';
481
+ ctxFloor.font = 'bold 36px monospace';
482
+ ctxFloor.fillText(`MATRIZ DE TRANSFORMACIÓN NUMÉRICA ρ_${currentDimSize}D(r) - REV_FACTOR: ${reversalZeroFactor.toFixed(2)}`, 50, 70);
483
+
484
+ let displayDim = Math.min(currentDimSize, 16);
485
+ let cellSize = Math.floor(1900 / displayDim);
486
+ let startX = 80;
487
+ let startY = 120;
488
+
489
+ ctxFloor.font = 'bold 18px monospace';
490
+
491
+ for (let i = 0; i < displayDim; i++) {
492
+ for (let j = 0; j < displayDim; j++) {
493
+ let cellX = startX + j * cellSize;
494
+ let cellY = startY + i * cellSize;
495
+
496
+ let isEven = (i + j) % 2 === 0;
497
+ let baseVal = 1.0 / ((i + 1) * (j + 1));
498
+
499
+ let val;
500
+ if (isEven) {
501
+ val = baseVal * (1.0 + Math.cosh(Math.abs(r) * 2) * 1.2517) * reversalZeroFactor;
502
+ ctxFloor.fillStyle = '#38bdf8';
503
+ } else {
504
+ val = baseVal * (1.0 + Math.sinh(Math.abs(r) * 2) * 1.0278) * reversalZeroFactor;
505
+ ctxFloor.fillStyle = '#f43f5e';
506
+ }
507
+
508
+ ctxFloor.strokeStyle = isEven ? 'rgba(56, 189, 248, 0.25)' : 'rgba(244, 63, 94, 0.25)';
509
+ ctxFloor.strokeRect(cellX, cellY, cellSize - 4, cellSize - 4);
510
+
511
+ let strVal = val < 0.01 ? val.toExponential(1) : val.toFixed(3);
512
+ ctxFloor.fillText(strVal, cellX + 8, cellY + (cellSize / 2));
513
+ }
514
+ }
515
+ floorTexture.needsUpdate = true;
516
+ }
517
+
518
+ // --- 6. GRÁFICO DE ESPACIO DE FASE Y CURL VECTORIAL ---
519
+ const chartCanvas = document.getElementById('spectralChart');
520
+ const ctxChart = chartCanvas.getContext('2d');
521
+
522
+ function calcularCurlYFrecuenciaMatriz(matrixStates, dimSize, t) {
523
+ let curlTotal = 0;
524
+ let count = 0;
525
+
526
+ for (let i = 1; i < dimSize - 1; i++) {
527
+ for (let j = 1; j < dimSize - 1; j++) {
528
+ let idxCenter = i * dimSize + j;
529
+ let idxRight = (i + 1) * dimSize + j;
530
+ let idxLeft = (i - 1) * dimSize + j;
531
+ let idxUp = i * dimSize + (j + 1);
532
+ let idxDown = i * dimSize + (j - 1);
533
+
534
+ if (matrixStates[idxCenter] && matrixStates[idxRight] && matrixStates[idxLeft] && matrixStates[idxUp] && matrixStates[idxDown]) {
535
+ let hR = matrixStates[idxRight].scale.y;
536
+ let hL = matrixStates[idxLeft].scale.y;
537
+ let hU = matrixStates[idxUp].scale.y;
538
+ let hD = matrixStates[idxDown].scale.y;
539
+
540
+ let dVz_dx = (hR - hL) / 2.0;
541
+ let dVx_dz = (hU - hD) / 2.0;
542
+
543
+ let curlLocal = Math.abs(dVz_dx - dVx_dz);
544
+ curlTotal += curlLocal;
545
+ count++;
546
+ }
547
+ }
548
+ }
549
+
550
+ let vorticidadPromedio = count > 0 ? curlTotal / count : 0;
551
+ let matrizFrecuenciaHz = (vorticidadPromedio * TELEMETRY_CONFIG.globalEnergyInvariant * TELEMETRY_CONFIG.harmonicConstant * reversalZeroFactor + Math.sin(t * 1.5) * 12.4 * reversalZeroFactor).toFixed(2);
552
+
553
+ document.getElementById('chart-tag').innerText = `Freq: ${matrizFrecuenciaHz} Hz (${TELEMETRY_CONFIG.targetNode})`;
554
+ return matrizFrecuenciaHz;
555
+ }
556
+
557
+ function dibujarEspacioFase(t) {
558
+ chartCanvas.width = chartCanvas.clientWidth;
559
+ chartCanvas.height = chartCanvas.clientHeight;
560
+ let w = chartCanvas.width;
561
+ let h = chartCanvas.height;
562
+
563
+ ctxChart.clearRect(0, 0, w, h);
564
+
565
+ ctxChart.strokeStyle = 'rgba(0, 240, 255, 0.3)';
566
+ ctxChart.lineWidth = 1;
567
+ ctxChart.beginPath();
568
+ ctxChart.moveTo(20, 5); ctxChart.lineTo(20, h - 10);
569
+ ctxChart.moveTo(20, h - 10); ctxChart.lineTo(w - 8, h - 10);
570
+ ctxChart.stroke();
571
+
572
+ ctxChart.strokeStyle = autoSequenceMode === 'REVERSAL_26D_1D' ? '#f43f5e' : (pipelinePhase === 'NON_LINEAR_EXEC' ? '#10b981' : '#00f0ff');
573
+ ctxChart.lineWidth = 2;
574
+ ctxChart.beginPath();
575
+
576
+ for (let x = 0; x < w - 28; x++) {
577
+ let px = 20 + x;
578
+ let normX = x / (w - 28);
579
+ let nonLinearWave = Math.sin(normX * 8 + t * 2) / (1.0 + 0.5 * Math.pow(Math.cos(normX * 4), 2));
580
+ let py = (h - 10) - (nonLinearWave * 16 * reversalZeroFactor + Math.tanh(Math.sin(t * 3 + normX * 5)) * 10 * reversalZeroFactor) - (h / 2.2);
581
+
582
+ if (x === 0) ctxChart.moveTo(px, py);
583
+ else ctxChart.lineTo(px, py);
584
+ }
585
+ ctxChart.stroke();
586
+ }
587
+
588
+ // --- 7. ANALIZADOR VECTORIAL POLAR DE 26 CANALES ---
589
+ function calcularFrecuencias26Canales(matrixStates, dimSize, t) {
590
+ const globalBase = parseFloat(TELEMETRY_CONFIG.globalEnergyInvariant || 3.5189);
591
+
592
+ for (let k = 0; k < 26; k++) {
593
+ if (k >= dimSize) {
594
+ channelFrequencies[k] = 0.01;
595
+ continue;
596
+ }
597
+
598
+ let gradienteCanal = 0;
599
+ let count = 0;
600
+
601
+ for (let j = 0; j < dimSize - 1; j++) {
602
+ let idxCurr = k * dimSize + j;
603
+ let idxNext = k * dimSize + (j + 1);
604
+
605
+ if (matrixStates[idxCurr] && matrixStates[idxNext]) {
606
+ let hCurr = matrixStates[idxCurr].scale.y;
607
+ let hNext = matrixStates[idxNext].scale.y;
608
+ gradienteCanal += Math.abs(hNext - hCurr);
609
+ count++;
610
+ }
611
+ }
612
+
613
+ let vorticidadCanal = count > 0 ? gradienteCanal / count : 0;
614
+ const armonicoMod = (k % 2 === 0) ? Math.cosh(0.04 * k) : Math.sinh(0.04 * k);
615
+ const freqHz = ((vorticidadCanal * globalBase * 2.2 + Math.sin(t * 1.5 + k * 0.24) * 3.8 + armonicoMod) * reversalZeroFactor).toFixed(2);
616
+
617
+ channelFrequencies[k] = Math.max(0.01, parseFloat(freqHz));
618
+ }
619
+
620
+ return channelFrequencies;
621
+ }
622
+
623
+ function renderizarGraficaVectorial26(canvasId, channelFreqs, activeDim = 26) {
624
+ const canvas = document.getElementById(canvasId);
625
+ if (!canvas) return;
626
+ const ctx = canvas.getContext('2d');
627
+
628
+ if (canvas.width !== canvas.clientWidth || canvas.height !== canvas.clientHeight) {
629
+ canvas.width = canvas.clientWidth || 320;
630
+ canvas.height = canvas.clientHeight || 190;
631
+ }
632
+
633
+ const width = canvas.width;
634
+ const height = canvas.height;
635
+ const cx = width / 2;
636
+ const cy = height / 2;
637
+ const maxRadius = Math.min(cx, cy) - 20;
638
+
639
+ ctx.clearRect(0, 0, width, height);
640
+ ctx.fillStyle = 'rgba(2, 6, 23, 0.95)';
641
+ ctx.fillRect(0, 0, width, height);
642
+
643
+ // Anillos concéntricos de referencia
644
+ ctx.strokeStyle = 'rgba(56, 189, 248, 0.15)';
645
+ ctx.lineWidth = 1;
646
+ for (let r = 1; r <= 3; r++) {
647
+ ctx.beginPath();
648
+ ctx.arc(cx, cy, (maxRadius / 3) * r, 0, Math.PI * 2);
649
+ ctx.stroke();
650
+ }
651
+
652
+ const totalChannels = 26;
653
+ const stepAngle = (Math.PI * 2) / totalChannels;
654
+
655
+ ctx.beginPath();
656
+ ctx.strokeStyle = autoSequenceMode === 'REVERSAL_26D_1D' ? '#f43f5e' : '#38bdf8';
657
+ ctx.lineWidth = 1.5;
658
+ ctx.fillStyle = autoSequenceMode === 'REVERSAL_26D_1D' ? 'rgba(244, 63, 94, 0.15)' : 'rgba(56, 189, 248, 0.12)';
659
+
660
+ let firstPoint = true;
661
+
662
+ for (let k = 0; k < totalChannels; k++) {
663
+ const angle = k * stepAngle - Math.PI / 2;
664
+ const freq = channelFreqs[k] || 0.01;
665
+
666
+ const normRadius = Math.min(maxRadius, (freq / 12.0) * maxRadius);
667
+ const vx = cx + Math.cos(angle) * normRadius;
668
+ const vy = cy + Math.sin(angle) * normRadius;
669
+
670
+ if (k < activeDim) {
671
+ if (firstPoint) {
672
+ ctx.moveTo(vx, vy);
673
+ firstPoint = false;
674
+ } else {
675
+ ctx.lineTo(vx, vy);
676
+ }
677
+ }
678
+
679
+ // Vector individual
680
+ ctx.save();
681
+ ctx.beginPath();
682
+ let isActive = k < activeDim;
683
+ if (isActive) {
684
+ ctx.strokeStyle = (k % 2 === 0) ? 'rgba(56, 189, 248, 0.5)' : 'rgba(244, 63, 94, 0.5)';
685
+ } else {
686
+ ctx.strokeStyle = 'rgba(71, 85, 105, 0.15)';
687
+ }
688
+ ctx.moveTo(cx, cy);
689
+ ctx.lineTo(vx, vy);
690
+ ctx.stroke();
691
+
692
+ // Nodo terminal
693
+ ctx.fillStyle = isActive ? ((k % 2 === 0) ? '#38bdf8' : '#f43f5e') : '#334155';
694
+ ctx.beginPath();
695
+ ctx.arc(vx, vy, isActive ? 2.5 : 1.0, 0, Math.PI * 2);
696
+ ctx.fill();
697
+
698
+ if (k % 2 === 0 || activeDim <= 11) {
699
+ const tx = cx + Math.cos(angle) * (maxRadius + 11);
700
+ const ty = cy + Math.sin(angle) * (maxRadius + 11);
701
+ ctx.fillStyle = isActive ? 'rgba(226, 232, 240, 0.6)' : 'rgba(71, 85, 105, 0.3)';
702
+ ctx.font = '7px monospace';
703
+ ctx.textAlign = 'center';
704
+ ctx.textBaseline = 'middle';
705
+ ctx.fillText(`C${k+1}`, tx, ty);
706
+ }
707
+ ctx.restore();
708
+ }
709
+
710
+ ctx.closePath();
711
+ ctx.fill();
712
+ ctx.stroke();
713
+
714
+ // Centro fasorial
715
+ ctx.fillStyle = reversalZeroFactor < 0.1 ? '#f43f5e' : '#ffffff';
716
+ ctx.beginPath();
717
+ ctx.arc(cx, cy, 3, 0, Math.PI * 2);
718
+ ctx.fill();
719
+ }
720
+
721
+ // --- 8. LÓGICA DE CONTROL Y MACRO-SECUENCIAS VECTORIALES ---
722
+ const rangeSweep = document.getElementById('rangeSweep');
723
+ const lblValR = document.getElementById('lblValR');
724
+ const valDim = document.getElementById('valDim');
725
+ const valMatter = document.getElementById('valMatter');
726
+ const valAntimatter = document.getElementById('valAntimatter');
727
+ const valFock = document.getElementById('valFock');
728
+ const btnAuto = document.getElementById('btnAuto');
729
+ const btnReset = document.getElementById('btnReset');
730
+ const algebraLog = document.getElementById('algebra-log');
731
+ const menuDim = document.getElementById('menu-dim');
732
+
733
+ function actualizarDimensionUI(dimSize, keyName) {
734
+ currentDimSize = dimSize;
735
+ selectedDimKey = keyName;
736
+ menuDim.value = keyName;
737
+
738
+ document.getElementById('hud-title').innerText = `Inspección Factorial Fuente (${keyName})`;
739
+ document.getElementById('hud-dim-tag').innerText = `${currentDimSize}x${currentDimSize}`;
740
+ document.getElementById('vector-hud-tag').innerText = `${currentDimSize} Canales`;
741
+
742
+ generarMatrizHTML(currentDimSize);
743
+ reconstruirEscena3D(currentDimSize);
744
+ }
745
+
746
+ function cambiarDimensionManual(val) {
747
+ autoSequenceMode = 'NONE';
748
+ reversalZeroFactor = 1.0;
749
+ let size = 26;
750
+ if (val === '1D') size = 1;
751
+ else if (val === '5D') size = 5;
752
+ else if (val === '11D') size = 11;
753
+ else if (val === '15D') size = 15;
754
+ else if (val === '26D') size = 26;
755
+
756
+ actualizarDimensionUI(size, val);
757
+ updateSystemState(parseFloat(rangeSweep.value));
758
+
759
+ algebraLog.innerHTML = `[${val}] Dimensión fijada manualmente a ${currentDimSize}x${currentDimSize}.`;
760
+ }
761
+
762
+ function iniciarSecuenciaForward() {
763
+ autoSequenceMode = 'FORWARD_5D_26D';
764
+ sequenceProgress = 0;
765
+ reversalZeroFactor = 1.0;
766
+ document.getElementById('status-badge').innerText = "Macro: Secuencia 5D → 26D";
767
+ document.getElementById('status-badge').style.color = '#38bdf8';
768
+ algebraLog.innerHTML = `[SECUENCIA] Iniciando barrido armónico vectorial progresivo desde 5D hasta 26D...`;
769
+ }
770
+
771
+ function iniciarSecuenciaReversal() {
772
+ autoSequenceMode = 'REVERSAL_26D_1D';
773
+ sequenceProgress = 0;
774
+ reversalZeroFactor = 1.0;
775
+ document.getElementById('status-badge').innerText = "Macro: Reversal 26D → 1D = 0";
776
+ document.getElementById('status-badge').style.color = '#f43f5e';
777
+ algebraLog.innerHTML = `[REVERSAL] Ejecutando reversión topológica 26D → 1D con extinción de campo a cero.`;
778
+ }
779
+
780
+ function procesarMacroSecuencias(delta) {
781
+ if (autoSequenceMode === 'FORWARD_5D_26D') {
782
+ sequenceProgress += delta * 0.25; // Transición gradual
783
+
784
+ let rVal = -0.5 + Math.sin(sequenceProgress * Math.PI) * 0.5;
785
+ rangeSweep.value = rVal.toFixed(3);
786
+
787
+ if (sequenceProgress < 0.25) {
788
+ if (currentDimSize !== 5) actualizarDimensionUI(5, '5D');
789
+ } else if (sequenceProgress < 0.50) {
790
+ if (currentDimSize !== 11) actualizarDimensionUI(11, '11D');
791
+ } else if (sequenceProgress < 0.75) {
792
+ if (currentDimSize !== 15) actualizarDimensionUI(15, '15D');
793
+ } else if (sequenceProgress < 1.0) {
794
+ if (currentDimSize !== 26) actualizarDimensionUI(26, '26D');
795
+ } else {
796
+ autoSequenceMode = 'NONE';
797
+ document.getElementById('status-badge').innerText = "Fase: 26D Alcanzado";
798
+ algebraLog.innerHTML = `[SECUENCIA COMPLETE] Acoplamiento pleno en 26D completado.`;
799
+ }
800
+ updateSystemState(parseFloat(rangeSweep.value));
801
+
802
+ } else if (autoSequenceMode === 'REVERSAL_26D_1D') {
803
+ sequenceProgress += delta * 0.2;
804
+
805
+ if (sequenceProgress < 0.25) {
806
+ if (currentDimSize !== 26) actualizarDimensionUI(26, '26D');
807
+ reversalZeroFactor = 1.0 - (sequenceProgress / 0.25) * 0.2;
808
+ } else if (sequenceProgress < 0.50) {
809
+ if (currentDimSize !== 15) actualizarDimensionUI(15, '15D');
810
+ reversalZeroFactor = 0.8 - ((sequenceProgress - 0.25) / 0.25) * 0.3;
811
+ } else if (sequenceProgress < 0.75) {
812
+ if (currentDimSize !== 11) actualizarDimensionUI(11, '11D');
813
+ reversalZeroFactor = 0.5 - ((sequenceProgress - 0.75) / 0.25) * 0.3;
814
+ } else if (sequenceProgress < 0.95) {
815
+ if (currentDimSize !== 5) actualizarDimensionUI(5, '5D');
816
+ reversalZeroFactor = 0.2 - ((sequenceProgress - 0.75) / 0.20) * 0.18;
817
+ } else if (sequenceProgress <= 1.2) {
818
+ if (currentDimSize !== 1) actualizarDimensionUI(1, '1D');
819
+ // Extinción total al llegar a 1D = 0
820
+ reversalZeroFactor = Math.max(0.0, 0.02 - (sequenceProgress - 0.95) * 0.1);
821
+ } else {
822
+ autoSequenceMode = 'NONE';
823
+ reversalZeroFactor = 0.0;
824
+ document.getElementById('status-badge').innerText = "Fase: Colapso 1D = 0";
825
+ algebraLog.innerHTML = `[REVERSAL COMPLETE] Colapso total alcanzado: Matriz nula en 1D = 0.`;
826
+ }
827
+ updateSystemState(parseFloat(rangeSweep.value));
828
+ }
829
+ }
830
+
831
+ function updateSystemState(r) {
832
+ lblValR.innerText = r.toFixed(3);
833
+
834
+ let energyMatter = (1.2517 + Math.cosh(Math.abs(r) * 2.5) * 0.35 + Math.sin(r * 10) * 0.05) * reversalZeroFactor;
835
+ let energyAntimatter = (1.0278 + Math.sinh(Math.abs(r) * 2.5) * 0.35 - Math.cos(r * 10) * 0.05) * reversalZeroFactor;
836
+
837
+ valMatter.innerText = energyMatter.toFixed(4);
838
+ valAntimatter.innerText = energyAntimatter.toFixed(4);
839
+
840
+ if (reversalZeroFactor === 0) {
841
+ valFock.innerText = "0.0000 (Singularidad Extinta)";
842
+ valFock.style.color = "#f43f5e";
843
+ valDim.innerText = "1D = 0 (Nulo)";
844
+ valDim.style.color = "#f43f5e";
845
+ } else {
846
+ let isResonance = Math.abs(r - (-0.25)) < 0.01 || Math.abs(r - (-0.42)) < 0.01;
847
+ if (isResonance) {
848
+ valFock.innerText = "0.0000 (F=0 Absorbido)";
849
+ valFock.style.color = "#38bdf8";
850
+ } else {
851
+ valFock.innerText = "Equilibrio Dinámico";
852
+ valFock.style.color = "#22c55e";
853
+ }
854
+
855
+ if (currentDimSize === 1) {
856
+ valDim.innerText = "1D - Colapso a Cero";
857
+ valDim.style.color = "#f43f5e";
858
+ } else if (r > -0.05) {
859
+ valDim.innerText = `${selectedDimKey} - Base Anclaje`;
860
+ valDim.style.color = "#fbbf24";
861
+ } else if (r >= -0.18) {
862
+ valDim.innerText = `${selectedDimKey} - Cero Espectral 1`;
863
+ valDim.style.color = "#38bdf8";
864
+ } else if (r >= -0.38) {
865
+ valDim.innerText = `${selectedDimKey} - Transición Topológica`;
866
+ valDim.style.color = "#22c55e";
867
+ } else {
868
+ valDim.innerText = `${selectedDimKey} - Cierre Bosónico Completo`;
869
+ valDim.style.color = "#f43f5e";
870
+ }
871
+ }
872
+
873
+ // Deformación de retícula 3D
874
+ matrixStates.forEach(bar => {
875
+ let dist = Math.sqrt(bar.userData.baseX**2 + bar.userData.baseZ**2);
876
+ let waveMod = Math.sin(dist * 0.4 + r * 12);
877
+
878
+ let heightScale;
879
+ if (bar.userData.isEven) {
880
+ heightScale = bar.userData.baseHeight * (1.0 + Math.cosh(Math.abs(r) * 2) * energyMatter * 0.3 + waveMod * 0.15) * reversalZeroFactor;
881
+ } else {
882
+ heightScale = bar.userData.baseHeight * (1.0 + Math.sinh(Math.abs(r) * 2) * energyAntimatter * 0.3 - waveMod * 0.15) * reversalZeroFactor;
883
+ }
884
+
885
+ if (pipelinePhase === 'NON_LINEAR_EXEC') {
886
+ let rho = bar.userData.density;
887
+ let nonLinearResponse = rho > 0 ? (rho / (1.0 + Math.pow(rho, 2))) * 12.0 : 0.02;
888
+ heightScale = Math.max(0.01, nonLinearResponse * reversalZeroFactor);
889
+ }
890
+
891
+ bar.scale.y = Math.max(0.01, heightScale);
892
+ });
893
+
894
+ updateZetaWave(r);
895
+ drawNumericMatrix(r);
896
+ }
897
+
898
+ function ejecutarDiracCero() {
899
+ pipelinePhase = 'DIRAC_ZERO';
900
+ document.getElementById('status-badge').innerText = "Fase: Dirac = 0";
901
+ document.getElementById('status-badge').style.color = '#f97316';
902
+ algebraLog.innerHTML = `[Dirac = 0] Operador espinorial anulado. Retícula de paridad ajustada a base cero.`;
903
+ updateSystemState(parseFloat(rangeSweep.value));
904
+ }
905
+
906
+ function ejecutarFusionFock() {
907
+ pipelinePhase = 'FOCK_FUSION';
908
+ document.getElementById('status-badge').innerText = "Fase: Fusión de Fock";
909
+ document.getElementById('status-badge').style.color = '#3b82f6';
910
+ algebraLog.innerHTML = `[Fock Fusion] Operadores bosónicos acoplados con éxito a la matriz fuente &rho;₂₆_D⁽²⁾.`;
911
+ updateSystemState(parseFloat(rangeSweep.value));
912
+ }
913
+
914
+ function ejecutarAlgebraNoLineal() {
915
+ pipelinePhase = 'NON_LINEAR_EXEC';
916
+ document.getElementById('status-badge').innerText = "Fase: Álgebra No Lineal";
917
+ document.getElementById('status-badge').style.color = '#10b981';
918
+ algebraLog.innerHTML = `[Álgebra No Lineal] Respuesta de solitón f(&rho;) = &rho; / (1 + &rho;²) activada.`;
919
+ updateSystemState(parseFloat(rangeSweep.value));
920
+ }
921
+
922
+ function toggleRotacionAutomatica() {
923
+ isAutoRotating = !isAutoRotating;
924
+ algebraLog.innerHTML = `[Giro 3D] Giro automático: ${isAutoRotating ? 'Activado' : 'Pausado'}.`;
925
+ }
926
+
927
+ rangeSweep.addEventListener('input', (e) => {
928
+ updateSystemState(parseFloat(e.target.value));
929
+ });
930
+
931
+ btnAuto.addEventListener('click', () => {
932
+ isAutoSweep = !isAutoSweep;
933
+ btnAuto.innerText = isAutoSweep ? "Pausar Barrido" : "Barrido r (Auto)";
934
+ });
935
+
936
+ btnReset.addEventListener('click', () => {
937
+ isAutoSweep = false;
938
+ autoSequenceMode = 'NONE';
939
+ reversalZeroFactor = 1.0;
940
+ btnAuto.innerText = "Barrido r (Auto)";
941
+ rangeSweep.value = 0.0;
942
+ actualizarDimensionUI(26, '26D');
943
+ updateSystemState(0.0);
944
+ algebraLog.innerHTML = `[REINICIO] Sistema restaurado a 26D Plena Matriz Fuente.`;
945
+ });
946
+
947
+ // --- 9. BUCLE PRINCIPAL DE ANIMACIÓN ---
948
+ const clock = new THREE.Clock();
949
+
950
+ function animate() {
951
+ requestAnimationFrame(animate);
952
+
953
+ let delta = clock.getDelta();
954
+ let t = clock.getElapsedTime();
955
+
956
+ // Procesamiento de macro-secuencias
957
+ if (autoSequenceMode !== 'NONE') {
958
+ procesarMacroSecuencias(delta);
959
+ }
960
+
961
+ if (isAutoRotating) {
962
+ master3DGroup.rotation.y = t * 0.05;
963
+ master3DGroup.rotation.x = Math.sin(t * 0.03) * 0.1;
964
+ }
965
+
966
+ if (isAutoSweep && autoSequenceMode === 'NONE') {
967
+ let val = parseFloat(rangeSweep.value);
968
+ val += 0.0015 * autoSweepDir;
969
+ if (val >= 0.0) { val = 0.0; autoSweepDir = -1; }
970
+ if (val <= -0.5) { val = -0.5; autoSweepDir = 1; }
971
+ rangeSweep.value = val;
972
+ updateSystemState(val);
973
+ }
974
+
975
+ // Animación continua de ondas en barras y cuerdas
976
+ matrixStates.forEach((bar) => {
977
+ let nonLinearFactor = pipelinePhase === 'NON_LINEAR_EXEC' ? 0.25 : 0.1;
978
+ let wave = Math.sin(t * 3.0 + bar.userData.phase + bar.userData.indexI * 0.3) * Math.cos(t * 2.0 - bar.userData.indexJ * 0.3);
979
+ let currentH = bar.scale.y;
980
+ bar.scale.y = Math.max(0.01, (currentH + wave * nonLinearFactor * 0.05) * (reversalZeroFactor > 0 ? 1 : 0));
981
+ });
982
+
983
+ stringsGroup.children.forEach((str, idx) => {
984
+ let posAttr = str.geometry.attributes.position;
985
+ for (let i = 0; i < posAttr.count; i++) {
986
+ let px = posAttr.getX(i);
987
+ let soliton = Math.sin(px * 0.4 + t * 4 + idx) / (0.5 + Math.abs(Math.cos(px * 0.1)));
988
+ let amp = (pipelinePhase === 'NON_LINEAR_EXEC' ? 1.2 : 0.4) * reversalZeroFactor;
989
+ posAttr.setY(i, soliton * amp);
990
+ }
991
+ posAttr.needsUpdate = true;
992
+ });
993
+
994
+ // 1. Cálculo del Curl global y espacio de fase
995
+ calcularCurlYFrecuenciaMatriz(matrixStates, currentDimSize, t);
996
+ dibujarEspacioFase(t);
997
+
998
+ // 2. Extracción espectral y renderizado vectorial polar
999
+ const freqs26 = calcularFrecuencias26Canales(matrixStates, currentDimSize, t);
1000
+ renderizarGraficaVectorial26('vectorCanvas26', freqs26, currentDimSize);
1001
+
1002
+ controls.update();
1003
+ renderer.render(scene, camera);
1004
+ }
1005
+
1006
+ // Inicialización
1007
+ generarMatrizHTML(26);
1008
+ reconstruirEscena3D(26);
1009
+ updateSystemState(0.0);
1010
+ animate();
1011
+
1012
+ window.addEventListener('resize', () => {
1013
+ camera.aspect = window.innerWidth / window.innerHeight;
1014
+ camera.updateProjectionMatrix();
1015
+ renderer.setSize(window.innerWidth, window.innerHeight);
1016
+ });
1017
+ </script>
1018
+ </body>
1019
+ </html>