More mucking around with colouring nodes

This commit is contained in:
Mike Lynch 2026-01-31 13:26:53 +11:00
parent 36b48b24e6
commit 29925962d0
4 changed files with 118 additions and 42 deletions

View File

@ -1,26 +1,15 @@
# NOTES # 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 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
This gives pairs of vertices: 5-cells - since each 5-cell has a vertex in each of the 600-cells, getting a
partition for just one will be enough.
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)
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)

View File

@ -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 // pick a starting point, collect coherent 5_cells, continue till
// there aren't any new ones // there aren't any new ones
@ -515,5 +515,40 @@ function coherent_one_set() {
console.log(JSON.stringify(idict, null, 2)); 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();

2
gui.js
View File

@ -6,7 +6,7 @@ const DEFAULTS = {
nodeopacity: 1, nodeopacity: 1,
linksize: 1.0, linksize: 1.0,
linkopacity: 0.75, linkopacity: 0.75,
shape: '120-cell', shape: '600-cell',
link2opacity: 0.75, link2opacity: 0.75,
option: 'none', option: 'none',
visibility: 5, visibility: 5,

View File

@ -216,6 +216,7 @@ export const cell24 = () => {
links16.map((l) => l.label = p); links16.map((l) => l.label = p);
links.push(...links16); links.push(...links16);
} }
// colour links `
// links.map((l) => { // links.map((l) => {
// const ls = [ l.source, l.target ].map((nid) => node_by_id(nodes, nid).label); // const ls = [ l.source, l.target ].map((nid) => node_by_id(nodes, nid).label);
// for ( const c of [1, 2, 3] ) { // for ( const c of [1, 2, 3] ) {
@ -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) { 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 = () => { export const cell120_inscribed_cell5 = () => {
const nodes = make_120cell_vertices(); const nodes = make_120cell_vertices();
const links = []; 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; const CELL5S = CELLINDEX.CELL120_CELL5.cell5s;
for( const c5 in CELL5S ) { for( const c5 in CELL5S ) {
@ -490,6 +532,7 @@ export const cell120_inscribed_cell5 = () => {
const links5 = auto_detect_edges(nodes5, 5); const links5 = auto_detect_edges(nodes5, 5);
links5.map((l) => l.label = Number(c5)); links5.map((l) => l.label = Number(c5));
links.push(...links5); links.push(...links5);
nodes5.map((n) => n.label = Number(c5));
} }
const show_links = Array.from({ length: 128 }, (_, i) => i); const show_links = Array.from({ length: 128 }, (_, i) => i);
@ -549,7 +592,6 @@ export const cell120_inscribe_cell5_subset = () => {
} }
} }
} }
console.log(link5s);
return { return {
name: '120-cell 5-cell subset', name: '120-cell 5-cell subset',
@ -558,7 +600,7 @@ export const cell120_inscribe_cell5_subset = () => {
options: [ options: [
{ name: "none", links: [ 0, 1, 2, 3, 4, 5, 8 ]}, { 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 nodes = make_600cell_vertices();
const links = auto_detect_edges(nodes, 12); 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 ) { for (const cstr in CELLINDEX.LAYERS600 ) {
label_nodes(nodes, CELLINDEX.LAYERS600[cstr], Number(cstr)); 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 options = [];
const layers = []; const layers = [];
@ -718,7 +771,7 @@ export const cell600_layered = () => {
options.push({ options.push({
name: CELLINDEX.LAYER_NAMES[i], name: CELLINDEX.LAYER_NAMES[i],
links: [...layers], links: [...layers],
nodes: [...layers] nodes: [...node_c, ...layers]
}) })
} }
@ -977,7 +1030,6 @@ export const build_all = () => {
cell600_layered(), cell600_layered(),
cell120_inscribed(), cell120_inscribed(),
cell120_inscribed_cell5(), cell120_inscribed_cell5(),
cell120_inscribe_cell5_subset(),
cell120_layered() cell120_layered()
]; ];
} }