diff --git a/explore_120cell.js b/explore_120cell.js index e2a508f..c30253d 100644 --- a/explore_120cell.js +++ b/explore_120cell.js @@ -100,11 +100,6 @@ export function chord_survey() { } } -// how to proceed: start with the 120-cell that has five 600-cells inscribed -// in it. Take the 120 nodes from one of those 600-cells, and construct a 5-cell -// from each such that all of the vertices are on different 600-cells. - -// collect them and output by label because every 5-cell is on all 5 600-cells function overlap(c1, c2) { for( const l in c1 ) { @@ -116,13 +111,13 @@ function overlap(c1, c2) { } -export function gather_5cells() { - const cell120 = POLYTOPES.cell120_inscribed(); +export function gather_5cells(cell120) { const CHORD5 = round_dist(Math.sqrt(2.5)); const bins = []; + const all = []; cell120.nodes.filter((n) => n.label === 1).map((n) => { - const g = distance_group(cell120, n, CHORD5); const cells = [ ]; + const g = distance_group(cell120, n, CHORD5); for( const pair of g ) { let seen = false; for( const cell of cells ) { @@ -146,26 +141,69 @@ export function gather_5cells() { cells.push(cell); } } - //console.log(`From ${n.id}`); - //console.log(cells); - for( const cell of cells ) { - let binned = false; - for( const bin of bins ) { - const overlaps = bin.filter((b) => overlap(b, cell)); - if( overlaps.length === 0 ) { - bin.push(cell); - binned = true; - break; - } - } - if( !binned ) { - console.log(`new bin for ${JSON.stringify(cell)}`); - bins.push([ cell ]); - } - } - //console.log(bins); - }) - ; + all.push(...cells); + }); + return all; } -gather_5cells(); +function audit_5cells(cells) { + // this verifies that for each label (a 600-cell set), each of its + // vertices is in exactly 7 5-cells. It checks out. + + ['1','2','3','4','5'].map((l) => { + const sets = {}; + for( const cell of cells ) { + const lv = cell[l]; + if( !(lv in sets) ) { + sets[lv] = []; + } + sets[lv].push(cell); + } + for( const lv in sets ) { + const ok = ( sets[lv].length === 7 ) ? 'ok' : 'miss'; + console.log(`${l},${lv},${sets[lv].length},${ok}`); + } + }); +} + +function try_120_5_cells(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 + + const vertices = cell120.nodes.filter((n) => n.label === l); + + const cellset = []; + for( const v of vertices ) { + console.log(`Vertex ${v.id}`); + 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; + } + const disjoint = vcells.filter((c) => ! overlap_any(cellset, c)); + console.log(`Found ${disjoint.length} disjoint cells`); + if( disjoint.length > 0 ) { + cellset.push(disjoint[0]); + } + } + console.log(`Found total of ${cellset.length} disjoint cells`); + //console.log(cellset); +} + + + + +const cell120 = POLYTOPES.cell120_inscribed(); +const all5 = gather_5cells(cell120); + +try_120_5_cells(cell120, all5, 1);