From 29925962d094221f55834693c6ee95b12e4fb35d Mon Sep 17 00:00:00 2001 From: Mike Lynch Date: Sat, 31 Jan 2026 13:26:53 +1100 Subject: [PATCH] More mucking around with colouring nodes --- NOTES.md | 29 +++++---------- explore_120cell.js | 41 +++++++++++++++++++-- gui.js | 2 +- polytopes.js | 88 ++++++++++++++++++++++++++++++++++++---------- 4 files changed, 118 insertions(+), 42 deletions(-) diff --git a/NOTES.md b/NOTES.md index 5e59b50..7f3e454 100644 --- a/NOTES.md +++ b/NOTES.md @@ -1,26 +1,15 @@ # NOTES -New approach for the 5-cells: +## Labelling the inscribed 600-cells in a 120-cell -Pick a tetrahedron of an inscribed 600-cell with vertices A, B, C, D - -This gives pairs of vertices: - -AB -AC -AD -BC -BD -CD - -Each of these gives rise to seven pairs of 5-cells which are on neighboring vertices -of the 5 600-cells. - -Try enumerating these and inspecting them to find one or more coherent sets of four -5-cells which lie on one tetrahedron from each of the 600-cells. - -(I expect there to be more than one, like how there are two ways to partition the -120-cell vertices into 600-cells) +I want to apply the partition of the 600-cell into five 24-cells to the inscribed +600-cells in the 120-cell, so that I can use this partition to colour the inscribed +5-cells - since each 5-cell has a vertex in each of the 600-cells, getting a +partition for just one will be enough. +The challenge is that the 600-cells in the 120-cell are rotated differently to the +coordinates for the original 600-cell. And I don't have enough maths to line them up. +What about - given one of the inscribed 600-cell, find all of the 24-cells? (there +are 25 possible ones so sorting them out will be a pain) diff --git a/explore_120cell.js b/explore_120cell.js index 3813dce..f7e7899 100644 --- a/explore_120cell.js +++ b/explore_120cell.js @@ -437,7 +437,7 @@ function coherent_5cells_r(cell120, all5, c5s, c50) { -function coherent_5cells(cell120, all5d) { +function coherent_5cells(cell120, all5) { // pick a starting point, collect coherent 5_cells, continue till // there aren't any new ones @@ -489,7 +489,7 @@ function coherent_all() { idict[i] = celli[i - 1]; } - console.log(JSON.stringify(idict, null, 2)); + console.log(JSON.stringify(idict, null, 2)); } @@ -515,5 +515,40 @@ function coherent_one_set() { console.log(JSON.stringify(idict, null, 2)); } +function cell120_csv() { + const cell120 = POLYTOPES.cell120_inscribed(); + const coords = [ 'x', 'y', 'z', 'w' ]; + console.log("id,label,x,y,z,w,zeroes"); + for( const n of cell120.nodes ) { + const zc = coords.filter((c) => n[c] === 0); + console.log(`${n.id},${n.label},${n.x},${n.y},${n.z},${n.w},${zc.length}`); + } +} + + +function cell600_links(cell600, n) { + const links = cell600.links.filter((l) => l.source === n.id || l.target === n.id); + const nbors = links.map((l) => { + if( l.source === n.id ) { + return l.target; + } else { + return l.source; + } + }); + return nbors.sort((a, b) => a - b); +} + + +function cell600_csv() { + const cell600 = POLYTOPES.cell600(); + console.log("id,label,x,y,z,w,d"); + const n0 = cell600.nodes[0]; + for( const n of cell600.nodes ) { + const d = dist(n0, n); + const nbors = cell600_links(cell600, n); + const nids = nbors.join(','); + console.log(`${n.id},${n.label},${n.x},${n.y},${n.z},${n.w},${d},${nids}`); + } +} +cell600_csv(); -coherent_one_set(); diff --git a/gui.js b/gui.js index 9baa3fe..c92b570 100644 --- a/gui.js +++ b/gui.js @@ -6,7 +6,7 @@ const DEFAULTS = { nodeopacity: 1, linksize: 1.0, linkopacity: 0.75, - shape: '120-cell', + shape: '600-cell', link2opacity: 0.75, option: 'none', visibility: 5, diff --git a/polytopes.js b/polytopes.js index 958d3c4..92aaf97 100644 --- a/polytopes.js +++ b/polytopes.js @@ -216,6 +216,7 @@ export const cell24 = () => { links16.map((l) => l.label = p); links.push(...links16); } + // colour links ` // links.map((l) => { // const ls = [ l.source, l.target ].map((nid) => node_by_id(nodes, nid).label); // for ( const c of [1, 2, 3] ) { @@ -325,11 +326,11 @@ function auto_120cell_faces(links) { export function make_120cell_vertices() { - const phi = 0.5 * (1 + Math.sqrt(5)); - const r5 = Math.sqrt(5); - const phi2 = phi * phi; - const phiinv = 1 / phi; - const phi2inv = 1 / phi2; + const phi = 0.5 * (1 + Math.sqrt(5)); + const r5 = Math.sqrt(5); + const phi2 = phi * phi; + const phiinv = 1 / phi; + const phi2inv = 1 / phi2; const nodes = [ PERMUTE.coordinates([0, 0, 2, 2], 0), @@ -348,6 +349,36 @@ export function make_120cell_vertices() { +export function make_120cell_vertices_alt() { + // unit radius version to make it easier to partition one of the 600-cells + const phi = 0.5 * (1 + Math.sqrt(5)); + const r5 = Math.sqrt(5); + const phi2 = phi * phi; + const phiinv = 1 / phi; + const phi2inv = 1 / phi2; + const r8 = Math.sqrt(8); + const p8 = phi / r8; + const r58 = r5 / r8; + const ir8 = 1 / r8; + const ip8 = phiinv / r8; + const p28 = phi2 / r8; + const ip28 = phi2inv / r8; + + const nodes = [ + PERMUTE.coordinates([1, 0, 0, 0], 1), + PERMUTE.coordinates([0.5, 0.5, 0.5, 0.5], 1), + PERMUTE.coordinates([0, phiinv * 0.5, 0.5, phi * 0.5], 1, true), + PERMUTE.coordinates([p8, p8, p8, ip28], 0, true), + PERMUTE.coordinates([ir8, ir8, ir8, r58], 0, true), + PERMUTE.coordinates([ip8, ip8, ip8, p28], 0, true), + PERMUTE.coordinates([0, ip8, p8, r58], 0, true), + PERMUTE.coordinates([0, ip28, ir8, p28], 0, true), + PERMUTE.coordinates([ip8, ir8, p8, 2 * ir8], 0, true), + ].flat(); + index_nodes(nodes); + return nodes; +} + function label_nodes(nodes, ids, label) { @@ -472,17 +503,28 @@ export const cell120_inscribed = () => { } +export const cell120_alt = () => { + const nodes = make_120cell_vertices_alt(); + const links = auto_detect_edges(nodes, 4); + + links.map((l) => l.label = 0); + + return { + name: '120-cell-alt', + nodes: nodes, + links: links, + options: [ + { name: "none", links: [ 0 ]}, + ], + description: `alt 120-cell`, + } +} + export const cell120_inscribed_cell5 = () => { const nodes = make_120cell_vertices(); const links = []; - for( const cstr in CELLINDEX.INDEX120 ) { - label_nodes(nodes, CELLINDEX.INDEX120[cstr], Number(cstr)); - } - - links.map((l) => l.label = 0); - const CELL5S = CELLINDEX.CELL120_CELL5.cell5s; for( const c5 in CELL5S ) { @@ -490,6 +532,7 @@ export const cell120_inscribed_cell5 = () => { const links5 = auto_detect_edges(nodes5, 5); links5.map((l) => l.label = Number(c5)); links.push(...links5); + nodes5.map((n) => n.label = Number(c5)); } const show_links = Array.from({ length: 128 }, (_, i) => i); @@ -530,8 +573,8 @@ export const cell120_inscribe_cell5_subset = () => { } } - // now add the links of the inscribed 600-cells which have the - // node subset in them + // now add the links of the inscribed 600-cells which have the + // node subset in them const link_subset = (l) => { const source = nodes_subset.filter((n) => n.id === l.source); @@ -549,7 +592,6 @@ export const cell120_inscribe_cell5_subset = () => { } } } - console.log(link5s); return { name: '120-cell 5-cell subset', @@ -558,7 +600,7 @@ export const cell120_inscribe_cell5_subset = () => { options: [ { name: "none", links: [ 0, 1, 2, 3, 4, 5, 8 ]}, ], - description: `Showing the subset of 5-cells in one icosahedron`, + description: `Showing only thirteen of the inscribed 5-cells and the links between them on the inscribed 600-cells`, } } @@ -695,7 +737,12 @@ export const cell600_layered = () => { const nodes = make_600cell_vertices(); const links = auto_detect_edges(nodes, 12); - nodes.map((n) => n.label = 9); // make all invisible by default + const plabels = {}; + + nodes.map((n) => { + plabels[n.id] = n.label; + n.label = 9 + }); // make all invisible by default for (const cstr in CELLINDEX.LAYERS600 ) { label_nodes(nodes, CELLINDEX.LAYERS600[cstr], Number(cstr)); @@ -710,6 +757,12 @@ export const cell600_layered = () => { } }); + // recolour nodes according to 24-cell partition + + nodes.map((n) => n.label = 8 + plabels[n.id]); + + const node_c = [ 8, 9, 10, 11, 12, 13, 14, 15 ]; + const options = []; const layers = []; @@ -718,7 +771,7 @@ export const cell600_layered = () => { options.push({ name: CELLINDEX.LAYER_NAMES[i], links: [...layers], - nodes: [...layers] + nodes: [...node_c, ...layers] }) } @@ -977,7 +1030,6 @@ export const build_all = () => { cell600_layered(), cell120_inscribed(), cell120_inscribed_cell5(), - cell120_inscribe_cell5_subset(), cell120_layered() ]; }