From a395006523559b0c69fb355f250fcbaf4d4dbffb Mon Sep 17 00:00:00 2001 From: Mike Lynch Date: Thu, 1 Jan 2026 17:05:23 +1100 Subject: [PATCH] Refactoring the code which finds coherent sets of 5-cells --- cellindex.js | 10 +++++++ explore_120cell.js | 74 ++++++++++++++++++++++++++++------------------ 2 files changed, 56 insertions(+), 28 deletions(-) diff --git a/cellindex.js b/cellindex.js index 14bc29c..b493671 100644 --- a/cellindex.js +++ b/cellindex.js @@ -117,7 +117,17 @@ export const CELL120_CELL5 = { "2": [ 223, 76, 238, 84, 225 ], "3": [ 253, 44, 283, 304, 42 ], "4": [ 419, 112, 197, 578, 521 ], + "5": [ 339, 14, 384, 382, 337 ], + "6": [ 331, 4, 335, 390, 386 ], + "7": [ 427, 160, 551, 146, 557 ], + "8": [ 265, 60, 64, 295, 246 ], + "9": [ 473, 100, 495, 213, 462 ], + "10": [ 393, 6, 328, 397, 326 ], + "11": [ 539, 164, 439, 561, 142 ], + "12": [ 511, 122, 456, 595, 181 ], + "13": [ 555, 154, 152, 545, 429 ] }, + }; diff --git a/explore_120cell.js b/explore_120cell.js index f544cff..134652c 100644 --- a/explore_120cell.js +++ b/explore_120cell.js @@ -114,6 +114,15 @@ function overlap(c1, c2) { return false; } +function c5match(c1, c2) { + for( const l in c1 ) { + if( c1[l] != c2[l] ) { + return false; + } + } + return true; +} + export function gather_5cells(cell120) { const CHORD5 = round_dist(Math.sqrt(2.5)); @@ -379,39 +388,48 @@ function cell5_neighbourhoods(cell120, all5, c5) { } -// pick a 5-cell, and then pick the nearest neighbours to its vertices on their -// respective inscribed 600-cells +function cell5_tetras(cell120, all5, c5) { + const nb = cell5_neighbourhoods(cell120, all5, c5); + const v1 = cell120node(cell120, c5["1"]); + const ts = tetras(cell120, v1); + + const c5s = []; + for( const t of ts ) { + const nt = nb.filter((n) => { + for( const l in n ) { + if( t.includes(n[l]) ) { + return true; + } + } + return false + }); + for( const nc5 of nt ) { + const exact = c5s.filter((c) => c5match(c, nc5)); + if( exact.length === 0 ) { + const o = c5s.filter((c) => overlap(c, nc5)); + if( o.length > 0 ) { + console.log("Overlap", c5, o); + } else { + c5s.push(nc5); + } + } + } + } + return c5s; +} + + + + + const cell120 = POLYTOPES.cell120_inscribed(); const all5 = gather_5cells(cell120); const c5 = all5[0] -const nb = cell5_neighbourhoods(cell120, all5, c5); +const c5s = cell5_tetras(cell120, all5, c5); -// trying for all tetras +const celli = c5s.map((c5) => [ "1", "2", "3", "4", "5" ].map((l) => c5[l])); -// 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"); -} +console.log(celli);