From 229218ec403ad98b6feb9dcbc8d2283db27f7660 Mon Sep 17 00:00:00 2001 From: Mike Lynch Date: Sat, 9 Sep 2023 17:50:43 +1000 Subject: [PATCH] Inscriptions of 16-cells in 24-cell --- main.js | 2 ++ polytopes.js | 38 ++++++++++++++++++++++++++++++-------- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/main.js b/main.js index f273da1..3282f19 100644 --- a/main.js +++ b/main.js @@ -70,12 +70,14 @@ const STRUCTURES = { const INSCRIBED = { 'tesseract': POLYTOPES.tesseract_inscribed(), + '24-cell': POLYTOPES.cell24_inscribed(), '120-cell': POLYTOPES.cell120_inscribed(), '600-cell': POLYTOPES.cell600_inscribed(), }; const ALL_INSCRIBED = { 'tesseract': POLYTOPES.tesseract_all_inscribed(), + '24-cell': POLYTOPES.cell24_all_inscribed(), '120-cell': POLYTOPES.cell120_all_inscribed(), '600-cell': POLYTOPES.cell600_all_inscribed(), } diff --git a/polytopes.js b/polytopes.js index 1969a81..5a3670d 100644 --- a/polytopes.js +++ b/polytopes.js @@ -188,14 +188,14 @@ export const cell24 = () => { index_nodes(nodes); const links = auto_detect_edges(nodes, 8); - links.map((l) => { - const ls = [ l.source, l.target ].map((nid) => node_by_id(nodes, nid).label); - for ( const c of [1, 2, 3] ) { - if( ! ls.includes(c) ) { - l.label = c - } - } - }); + // links.map((l) => { + // const ls = [ l.source, l.target ].map((nid) => node_by_id(nodes, nid).label); + // for ( const c of [1, 2, 3] ) { + // if( ! ls.includes(c) ) { + // l.label = c + // } + // } + // }); return { nodes: nodes, @@ -208,6 +208,28 @@ export const cell24 = () => { } +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]); + + + // face detection for the 120-cell // NOTE: all of these return node ids, not nodes