From 4bf38858ea530456428b8cf21da440f85312767c Mon Sep 17 00:00:00 2001 From: Mike Lynch Date: Wed, 1 Nov 2023 11:43:54 +1100 Subject: [PATCH] Added 24-cell --- polytopes.js | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/polytopes.js b/polytopes.js index d27557c..986d0f4 100644 --- a/polytopes.js +++ b/polytopes.js @@ -185,7 +185,14 @@ export const cell24 = () => { index_nodes(nodes); const links = auto_detect_edges(nodes, 8); + links.map((l) => l.label = 0); + for( const p of [ 1, 2, 3 ] ) { + const nodes16 = nodes.filter((n) => n.label === p); + const links16 = auto_detect_edges(nodes16, 6); + links16.map((l) => l.label = p); + links.push(...links16); + } // links.map((l) => { // const ls = [ l.source, l.target ].map((nid) => node_by_id(nodes, nid).label); // for ( const c of [1, 2, 3] ) { @@ -196,6 +203,7 @@ export const cell24 = () => { // }); return { + name: '24-cell', nodes: nodes, links: links, geometry: { @@ -204,32 +212,14 @@ export const cell24 = () => { }, base: {}, options: [ - [ 'One inscribed 16-cell', {} ], - [ 'All inscribed 16-cells', {} ], + { name: 'none', links: [ 0 ] }, + { name: 'one 16-cell', links: [ 0, 1 ] }, + { name: 'three 16-cells', links: [ 0, 1, 2, 3 ] } ] }; } -const cell24_some_inscribed = (ps) => { - const t = cell24(); - - const i_links = []; - - for( const p of ps ) { - const nodes16 = t.nodes.filter((n) => n.label === p); - const links16 = auto_detect_edges(nodes16, 6); - links16.map((l) => l.label = p); - i_links.push(...links16); - } - - t.links.push(...i_links); - return t; -} - - -export const cell24_inscribed = () => cell24_some_inscribed([1]); -export const cell24_all_inscribed = () => cell24_some_inscribed([1,2,3]); @@ -780,6 +770,7 @@ export const build_all = () => { cell5(), cell16(), tesseract(), + cell24(), cell120_inscribed() ]; } \ No newline at end of file