diff --git a/explore_120cell.js b/explore_120cell.js index 975287a..f544cff 100644 --- a/explore_120cell.js +++ b/explore_120cell.js @@ -1,14 +1,4 @@ -// 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 @@ -302,15 +292,12 @@ function find_adjoining_5cells(cell120, all5, v1, v2) { return c5pairs; } - - -function tetras(cell120, all5, v) { +function tetras(cell120, v) { // given a vertex v, find all of the 600-cell tetras it's on const n600s = neighbours600(cell120, v.id); // need to find all sets of three neighbours which are neighbours: there // should be 20 of these because they're faces of an icosahedron - console.log(v.id); const tetras = new Set; for( const v2id of n600s ) { // find mutual neighbours of the first two @@ -331,14 +318,23 @@ function tetras(cell120, all5, v) { } } } - console.log(tetras); + const tarray = []; + for( const t of tetras ) { + const ta = t.split(',').map((v) => Number(v)); + tarray.push(ta); + } + return tarray; +} + +function vertices(hedra) { + const v = new Set; + for ( const h of hedra) { + for( const p of h ) { + v.add(p); + } + } + return Array.from(v); } -/* // find mutuals which are mutuals of each other - const m0 = mutuals[0]; - const mn = neighbours600(cell120, m0); - const mm = mn.filter((nid) => nid != m0 && mutuals.includes(nid)); - return [ v1.id, v2id, m0, mm[0] ]; -}*/ function str5cell(c5) { return ["1","2","3","4","5"].map((l) => String(c5[l]).padStart(3, '0')).join('-'); @@ -360,11 +356,62 @@ function tetra_sets(cell120, all5, tetra) { } } +function cell5_neighbourhoods(cell120, all5, c5) { + const neighbours = {} + + for( const l in c5 ) { + const v = cell120node(cell120, c5[l]); + neighbours[l] = vertices(tetras(cell120, v)); + } + + // now take the set of all 5-cells and filter it to only those whose vertices + // are in the neighour sets. On first inspection there are 13? + + const n5cells = all5.filter((c5) => { + for( const l in c5 ) { + if( ! neighbours[l].includes(c5[l]) ) { + return false; + } + } + return true; + }); + return n5cells; +} + + +// pick a 5-cell, and then pick the nearest neighbours to its vertices on their +// respective inscribed 600-cells + const cell120 = POLYTOPES.cell120_inscribed(); const all5 = gather_5cells(cell120); -const v1 = cell120.nodes[0]; +const c5 = all5[0] -tetras(cell120, all5, v1); -tetras(cell120, all5, cell120.nodes[1]); +const nb = cell5_neighbourhoods(cell120, all5, c5); +// trying for all tetras + +// let's pick a tetra on the first vertex of the primary 5cell... + +const v1 = cell120node(cell120, c5["1"]); +const ts = tetras(cell120, v1); + +for( const t of ts ) { + + console.log(t); + + // ... and then see which of the neighbourhood 5-cells have at least one + // of its vertices + + const nt = nb.filter((n) => { + for( const l in n ) { + if( t.includes(n[l]) ) { + return true; + } + } + return false + }); + + console.log(nt); + console.log("\n"); +}