synchro du labo (0bf0da65) : app.blade.php, README.md
This commit is contained in:
22
README.md
22
README.md
@@ -1,3 +1,21 @@
|
||||
# ploxion-dimensions
|
||||
# 🔷 Dimensions
|
||||
|
||||
PLOXION · LES OBJETS EN TOUTES LES DIMENSIONS (RS-7 : « fais un ploxion pour les objets en 4-5-6-7-8-9- toutes les dimensions »). De vrais polytopes n-dimensionnels calculés puis projetés D→…→2 en perspective et tournés en direct dans plusieurs plans (rotation à la 4D). Trois familles : hypercube (n-cube = le cubion généralisé, 2^D sommets), croix (n-orthoplexe, dual), simplexe (n+1 sommets tous reliés). Slider 2→9, chaque D porte son nom xerboxion (deudion·troidion·quadion·cindion·sisdion·nion). Déterministe, canvas gardé, reduced-motion respecté, zéro LLM. · fournit: dimensions, hypercube, polytope, geometrie, nion, 4d, visualiseur
|
||||
LES OBJETS EN TOUTES LES DIMENSIONS (RS-7 : « fais un ploxion pour les objets en 4-5-6-7-8-9- toutes les dimensions »). De vrais polytopes n-dimensionnels calculés puis projetés D→…→2 en perspective et tournés en direct dans plusieurs plans (rotation à la 4D). Trois familles : hypercube (n-cube = le cubion généralisé, 2^D sommets), croix (n-orthoplexe, dual), simplexe (n+1 sommets tous reliés). Slider 2→9, chaque D porte son nom xerboxion (deudion·troidion·quadion·cindion·sisdion·nion). Déterministe, canvas gardé, reduced-motion respecté, zéro LLM.
|
||||
|
||||
| | |
|
||||
| --- | --- |
|
||||
| id | `dimensions` |
|
||||
| fournit | `dimensions` `hypercube` `polytope` `geometrie` `nion` `4d` `visualiseur` |
|
||||
| bions qu'il nomme | `jOSApps` `jOSPorts` |
|
||||
| fichiers | `app.blade.php` |
|
||||
| dans le labo | `resources/views/ploxions/dimensions/` (dépôt `my_website2`) |
|
||||
|
||||
## Contribuer
|
||||
|
||||
- **Dans le xer** : https://labo.j0bot.ch/px/atelier?ploxion=dimensions — prends-le, modifie-le, vois-le tourner, « ⧗ envoyer le tsoin ».
|
||||
- **Dans VS Code** : `xb prendre dimensions` (ou l'extension xerboxion › ⇩ Prendre), puis ⧗ Envoyer.
|
||||
- Le chemin complet : https://labo.j0bot.ch/px/contribuer
|
||||
|
||||
Ce dépôt est un **miroir** du labo (synchronisé par `bin/ploxions-forge.mjs`, depuis le commit `0bf0da65`) : une modif se propose par un tsoin ou une branche du labo, pas directement ici.
|
||||
|
||||
© 2026 chill-tekk · ne pas nuire
|
||||
|
||||
130
app.blade.php
Normal file
130
app.blade.php
Normal file
@@ -0,0 +1,130 @@
|
||||
{{-- PL0XION dimensions 🔷 — LES OBJETS EN TOUTES LES DIMENSIONS (RS-7 : « fais un ploxion pour les objets
|
||||
en 4-5-6-7-8-9- toutes les dimensions »). Vrais polytopes n-dimensionnels calculés puis projetés
|
||||
D→…→2 en perspective, tournés en direct dans plusieurs plans (rotation à la 4D). Trois familles :
|
||||
· hypercube (n-cube) = le CUBION généralisé (2^D sommets)
|
||||
· croix (n-orthoplexe) = son dual (2D sommets)
|
||||
· simplexe (n+1 sommets tous reliés)
|
||||
Slider de dimension 2→9, chaque D porte son nom xerboxion (deudion·troidion·quadion·cindion·sisdion·
|
||||
nion). Déterministe, zéro LLM, self-contained, canvas gardé (jsdom-safe), reduced-motion respecté.
|
||||
window.jOSApps['dimensions']. --}}
|
||||
<style>
|
||||
.dm{position:absolute;inset:0;display:flex;flex-direction:column;overflow:hidden;background:var(--xr-bg,#05070d);color:var(--xr-text,#dbe7f7);font-family:var(--xr-font-ui,ui-sans-serif,system-ui)}
|
||||
.dm *{box-sizing:border-box;-webkit-tap-highlight-color:transparent;min-width:0}
|
||||
.dm__h{flex:0 0 auto;padding:calc(env(safe-area-inset-top,0px) + 10px) 13px 4px}
|
||||
.dm__t{font-weight:800;color:var(--xr-accent,#7fd8ff);font-size:1.0rem}
|
||||
.dm__s{font-size:.67rem;color:var(--xr-muted,#8aa6c8);margin-top:2px}
|
||||
.dm__cv{flex:1;min-height:0;display:block;width:100%;background:radial-gradient(ellipse at 50% 45%,#0a1526,#05070d 75%)}
|
||||
.dm__fallback{flex:1;display:grid;place-items:center;padding:20px;text-align:center;color:var(--xr-muted,#8aa6c8);font-size:.8rem;line-height:1.5}
|
||||
.dm__ctl{flex:0 0 auto;padding:8px 12px calc(env(safe-area-inset-bottom,0px) + 12px);border-top:1px solid var(--xr-border,#15233c);display:flex;flex-direction:column;gap:8px}
|
||||
.dm__dims{display:flex;gap:5px;flex-wrap:wrap;align-items:center}
|
||||
.dm__d{cursor:pointer;border:1px solid var(--xr-border,#22344f);background:rgba(18,30,50,.6);color:var(--xr-muted,#9ab6d8);font:inherit;font-weight:700;font-size:.82rem;width:34px;height:34px;border-radius:9px}
|
||||
.dm__d.on{background:var(--xr-accent,#7fd8ff);color:#04121a;border-color:transparent}
|
||||
.dm__row{display:flex;gap:7px;align-items:center;flex-wrap:wrap}
|
||||
.dm__seg{display:flex;gap:4px}
|
||||
.dm__b{cursor:pointer;border:1px solid var(--xr-border,#22344f);background:rgba(18,30,50,.6);color:var(--xr-muted,#9ab6d8);font:inherit;font-size:.72rem;padding:6px 10px;border-radius:8px}
|
||||
.dm__b.on{background:rgba(127,216,255,.2);color:#cfe8ff;border-color:rgba(127,216,255,.6)}
|
||||
.dm__name{margin-left:auto;font-family:ui-monospace,monospace;font-size:.7rem;color:var(--xr-muted,#8aa6c8);text-align:right;line-height:1.35}
|
||||
.dm__name b{color:#a9d8ff}
|
||||
</style>
|
||||
<script>
|
||||
(function () {
|
||||
'use strict';
|
||||
var DIMNAME = { 2:'deudion', 3:'troidion', 4:'quadion', 5:'cindion', 6:'sisdion', 7:'7ion', 8:'8ion', 9:'9ion' };
|
||||
|
||||
function mount(container, ctx) {
|
||||
var alive = true, raf = 0, D = 4, shape = 'cube', playing = true, theta = 0;
|
||||
var reduce = false; try { reduce = window.matchMedia && matchMedia('(prefers-reduced-motion: reduce)').matches; } catch (e) {}
|
||||
if (reduce) playing = false;
|
||||
|
||||
container.innerHTML =
|
||||
'<div class="dm">'
|
||||
+ ' <div class="dm__h"><div class="dm__t">🔷 Dimensions — objets en 4·5·6·7·8·9…</div>'
|
||||
+ ' <div class="dm__s">de vrais polytopes n-dimensionnels, projetés et tournés dans plusieurs plans à la fois.</div></div>'
|
||||
+ ' <canvas class="dm__cv"></canvas>'
|
||||
+ ' <div class="dm__ctl">'
|
||||
+ ' <div class="dm__dims" data-dims></div>'
|
||||
+ ' <div class="dm__row"><div class="dm__seg" data-shapes>'
|
||||
+ '<button class="dm__b on" data-sh="cube">▦ hypercube</button>'
|
||||
+ '<button class="dm__b" data-sh="cross">◇ croix</button>'
|
||||
+ '<button class="dm__b" data-sh="simplex">△ simplexe</button></div>'
|
||||
+ '<button class="dm__b" data-play>' + (playing ? '⏸' : '▶') + '</button>'
|
||||
+ '<span class="dm__name" data-name></span></div>'
|
||||
+ ' </div>'
|
||||
+ '</div>';
|
||||
var root = container.querySelector('.dm'), cv = root.querySelector('.dm__cv');
|
||||
var elDims = root.querySelector('[data-dims]'), elName = root.querySelector('[data-name]');
|
||||
var g = cv.getContext && cv.getContext('2d');
|
||||
|
||||
elDims.innerHTML = [2,3,4,5,6,7,8,9].map(function (d) { return '<button class="dm__d' + (d === D ? ' on' : '') + '" data-d="' + d + '">' + d + '</button>'; }).join('');
|
||||
|
||||
// ── géométrie n-dimensionnelle ──────────────────────────────────────────
|
||||
var V = [], E = [];
|
||||
function build() {
|
||||
V = []; E = [];
|
||||
var i, j, k;
|
||||
if (shape === 'cube') { // n-cube : 2^D sommets ±1
|
||||
var n = 1 << D;
|
||||
for (i = 0; i < n; i++) { var c = []; for (k = 0; k < D; k++) c.push((i >> k) & 1 ? 1 : -1); V.push(c); }
|
||||
for (i = 0; i < n; i++) for (k = 0; k < D; k++) { var jj = i | (1 << k); if (jj !== i && !((i >> k) & 1)) E.push([i, jj]); }
|
||||
} else if (shape === 'cross') { // n-orthoplexe : 2D sommets ±e_k
|
||||
for (k = 0; k < D; k++) { var a = []; var b = []; for (j = 0; j < D; j++) { a.push(j === k ? 1 : 0); b.push(j === k ? -1 : 0); } V.push(a); V.push(b); }
|
||||
for (i = 0; i < V.length; i++) for (j = i + 1; j < V.length; j++) { if (Math.floor(i / 2) !== Math.floor(j / 2)) E.push([i, j]); }
|
||||
} else { // n-simplexe : D+1 sommets tous reliés
|
||||
var cc = (1 - Math.sqrt(D + 1)) / D;
|
||||
for (i = 0; i < D; i++) { var v = []; for (j = 0; j < D; j++) v.push(i === j ? 1 : 0); V.push(v); }
|
||||
var last = []; for (j = 0; j < D; j++) last.push(cc); V.push(last);
|
||||
var cen = []; for (j = 0; j < D; j++) { var m = 0; for (i = 0; i < V.length; i++) m += V[i][j]; cen.push(m / V.length); }
|
||||
V = V.map(function (p) { return p.map(function (x, j) { return (x - cen[j]) * 1.6; }); });
|
||||
for (i = 0; i < V.length; i++) for (j = i + 1; j < V.length; j++) E.push([i, j]);
|
||||
}
|
||||
}
|
||||
function rot(c, i, j, a) { var ci = c[i], cj = c[j], s = Math.sin(a), co = Math.cos(a); c[i] = ci * co - cj * s; c[j] = ci * s + cj * co; }
|
||||
function project(src) { // rotation multi-plans + projection D→2 en perspective
|
||||
var c = src.slice(), d;
|
||||
for (d = 0; d + 1 < D; d += 2) rot(c, d, d + 1, theta * (0.4 + 0.12 * d));
|
||||
if (D > 2) rot(c, 0, D - 1, theta * 0.33); // plan "croisé" → sensation 4D
|
||||
for (d = D; d > 2; d--) { var w = c[d - 1], f = 1 / (3.1 - w); for (var kk = 0; kk < d - 1; kk++) c[kk] *= f; }
|
||||
return [c[0], c[1] || 0];
|
||||
}
|
||||
function frame() {
|
||||
if (!alive || !g) return;
|
||||
var W = cv.width = cv.clientWidth || 320, H = cv.height = cv.clientHeight || 300;
|
||||
g.clearRect(0, 0, W, H);
|
||||
var pts = V.map(project), i, maxR = 0.001;
|
||||
for (i = 0; i < pts.length; i++) { var r = Math.hypot(pts[i][0], pts[i][1]); if (r > maxR) maxR = r; }
|
||||
var sc = Math.min(W, H) * 0.42 / maxR, cx = W / 2, cy = H / 2;
|
||||
// arêtes
|
||||
g.lineWidth = D >= 8 ? 0.5 : 0.8; g.strokeStyle = 'rgba(127,216,255,' + (E.length > 900 ? 0.16 : 0.4) + ')';
|
||||
g.beginPath();
|
||||
for (i = 0; i < E.length; i++) { var a = pts[E[i][0]], b = pts[E[i][1]]; g.moveTo(cx + a[0] * sc, cy + a[1] * sc); g.lineTo(cx + b[0] * sc, cy + b[1] * sc); }
|
||||
g.stroke();
|
||||
// sommets
|
||||
g.fillStyle = 'rgba(180,230,255,.9)';
|
||||
for (i = 0; i < pts.length; i++) { g.beginPath(); g.arc(cx + pts[i][0] * sc, cy + pts[i][1] * sc, pts.length > 200 ? 1.1 : 2, 0, 6.2832); g.fill(); }
|
||||
if (playing) theta += 0.012;
|
||||
raf = (window.requestAnimationFrame ? requestAnimationFrame(frame) : 0);
|
||||
if (!playing && !window.requestAnimationFrame) return;
|
||||
}
|
||||
function nameHtml() {
|
||||
var nm = DIMNAME[D] || (D + 'ion');
|
||||
elName.innerHTML = '<b>' + D + 'D · ' + nm + '</b><br>' + V.length + ' sommets · ' + E.length + ' arêtes' + (DIMNAME[D] ? '' : ' <span style="opacity:.6">(nion générique)</span>');
|
||||
}
|
||||
function refresh() { build(); nameHtml(); if (g) { if (window.requestAnimationFrame && playing) { if (!raf) frame(); } else frame(); } }
|
||||
|
||||
if (!g) { cv.replaceWith(Object.assign(document.createElement('div'), { className: 'dm__fallback', textContent: 'rendu canvas indispo ici — sur le xer tu verras l\'hypercube (' + (1 << D) + ' sommets) tourner en direct dans plusieurs plans à la fois.' })); }
|
||||
|
||||
elDims.addEventListener('click', function (e) { var b = e.target.closest('[data-d]'); if (!b) return; D = +b.getAttribute('data-d'); elDims.querySelectorAll('[data-d]').forEach(function (o) { o.classList.toggle('on', o === b); }); refresh(); });
|
||||
root.querySelector('[data-shapes]').addEventListener('click', function (e) { var b = e.target.closest('[data-sh]'); if (!b) return; shape = b.getAttribute('data-sh'); root.querySelectorAll('[data-sh]').forEach(function (o) { o.classList.toggle('on', o === b); }); refresh(); });
|
||||
root.querySelector('[data-play]').addEventListener('click', function (e) { playing = !playing; e.target.textContent = playing ? '⏸' : '▶'; if (playing && g && window.requestAnimationFrame && !raf) frame(); });
|
||||
|
||||
build(); nameHtml();
|
||||
if (g) { if (window.requestAnimationFrame) frame(); else frame(); }
|
||||
try { window.jOSPorts && jOSPorts.emit && jOSPorts.emit('dimensions', 'open', { D: D, shape: shape }); } catch (e) {}
|
||||
|
||||
return { unmount: function () { alive = false; if (raf && window.cancelAnimationFrame) cancelAnimationFrame(raf); container.innerHTML = ''; } };
|
||||
}
|
||||
|
||||
window.jOSApps = window.jOSApps || {};
|
||||
window.jOSApps['dimensions'] = { manifest: { id: 'dimensions', name: 'Dimensions', icon: '🔷' }, mount: mount };
|
||||
})();
|
||||
</script>
|
||||
Reference in New Issue
Block a user