From 137f7db0662f3e663e5e75d4b6b9ba12d0045be2 Mon Sep 17 00:00:00 2001 From: Mike Lynch Date: Sun, 28 Dec 2025 18:05:42 +1100 Subject: [PATCH] Getting closer to an algorithm for the 120 5-cell inscription --- explore_120cell.js | 120 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 114 insertions(+), 6 deletions(-) diff --git a/explore_120cell.js b/explore_120cell.js index c30253d..474d301 100644 --- a/explore_120cell.js +++ b/explore_120cell.js @@ -1,10 +1,24 @@ +// TODO - try visualising the 5-cells from a vertex on the layered 120-cell +// and get an intuition for how they work with the dodecahedral structure + +// Another new approach - +// pick a starting 5-cell +// look at the neighbours on the 120-cell of all of its 5 vertices +// try to find abother 5-cell with these neighbours +// if there's only one, add that to the list and keep going +// if there's more than one, are they disjoint with each other? import * as POLYTOPES from './polytopes.js'; // exploring more inscriptions of the 120-cell +function choice(a) { + const r = Math.floor(Math.random() * a.length); + return a[r]; +} + export function nodes_links(links, nodeid) { return links.filter((l) => l.source === nodeid || l.target === nodeid); } @@ -166,11 +180,13 @@ function audit_5cells(cells) { }); } -function try_120_5_cells(cell120, cells, l) { +function try_120_5_cells_fails(cell120, cells, l) { // iterate over every vertex in the 600-cell defined by label l, // get all 7 5-cells including that vertex, and add them if they are // disjoint with what we already have + // this always runs out of disjoint nodes early + const vertices = cell120.nodes.filter((n) => n.label === l); const cellset = []; @@ -179,13 +195,11 @@ function try_120_5_cells(cell120, cells, l) { const vcells = cells.filter((c) => c[l] === v.id); const overlap_any = (cs, c) => { for( const seen of cs ) { - console.log(c); if( overlap(seen, c) ) { console.log("overlap"); - console.log(seen); console.log(c); return true; - + } } return false; @@ -193,17 +207,111 @@ function try_120_5_cells(cell120, cells, l) { const disjoint = vcells.filter((c) => ! overlap_any(cellset, c)); console.log(`Found ${disjoint.length} disjoint cells`); if( disjoint.length > 0 ) { - cellset.push(disjoint[0]); + cellset.push(choice(disjoint)); } } console.log(`Found total of ${cellset.length} disjoint cells`); //console.log(cellset); } +function overlap_any(cs, c) { + for( const seen of cs ) { + if( overlap(seen, c) ) { + return true; + } + } + return false; +} + + +function explore_disjoint(cell120, all5, l) { + const a = all5[0]; + + const overlaps = all5.filter((c) => overlap(c, a)); + + console.log(a); + + console.log(overlaps.length); + console.log(overlaps); +} + +// select a five-cell from a starting vertex v +// find a neighbor of v vn on its 600 cell, find all of the 5-cells which include +// vn. Then see if we can find any from that set which are similiar neighbours to +// the other four vertices in the first 5-cell + +// the idea is that the 600-cells are a guide to finding the right subset of +// 5-cells + +function neighbours600(cell120, vid) { + const v = cell120.nodes.filter((node) => node.id === vid)[0]; + const label = v.label; + const links = cell120.links.filter((l) => { + return l.label === v.label && (l.source === v.id || l.target == v.id ); + }); + const nodes = links.map((l) => { + if( l.source === v.id ) { + return l.target; + } else { + return l.source; + } + }); + return nodes; +} + +function cell120node(cell120, nid) { + return cell120.nodes.filter((n) => n.id === nid)[0]; +} + +function node_dist(cell120, aid, bid) { + const a = cell120node(cell120, aid); + const b = cell120node(cell120, bid); + return dist(a, b); +} + + + +function follow_600(cell120, all5) { + const v = cell120.nodes[0]; + console.log("Start vertex:"); + console.log(v); + const v5s = all5.filter((c5) => c5[v.label] === v.id); + console.log(`Vertex ${v.id} belongs to these 5-cells:`); + console.log(v5s); + const n600s = neighbours600(cell120, v.id); + const n600id = n600s[0]; + const n600 = cell120node(cell120, n600id); + console.log("One 600-cell neighbour:"); + console.log(n600); + const DIST600 = round_dist(node_dist(cell120, v.id, n600id)); + const nv5s = all5.filter((c5) => c5[v.label] === n600id); + console.log(`Vertex ${n600id} belongs to these 5-cells:`); + console.log(nv5s); + console.log("Distances for each pair of 5-cells from the two sets:"); + for( const v5a of v5s ) { + for( const v5b of nv5s ) { + let match = true; + const d = {}; + for( const label in v5a ) { + d[label] = round_dist(node_dist(cell120, v5a[label], v5b[label])); + if( d[label] != DIST600 ) { + match = false; + } + } + if( match ) { + console.log("--- pair ---"); + console.log(v5a); + console.log(v5b); + } + } + } +} + const cell120 = POLYTOPES.cell120_inscribed(); const all5 = gather_5cells(cell120); -try_120_5_cells(cell120, all5, 1); +follow_600(cell120, all5); +