From 76f463ae03c2365e8c985b31bdc944124e6dc50b Mon Sep 17 00:00:00 2001 From: Mike Lynch Date: Wed, 1 Nov 2023 11:14:57 +1100 Subject: [PATCH] Added refactored tesseract --- main.js | 2 +- polytopes.js | 21 ++++++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/main.js b/main.js index b9dc28e..eedf7a9 100644 --- a/main.js +++ b/main.js @@ -62,7 +62,7 @@ for( const face_m of face_ms ) { } -const STRUCTURES = [ POLYTOPES.cell120_inscribed() ]; +const STRUCTURES = POLYTOPES.build_all(); const STRUCTURES_BY_NAME = {}; diff --git a/polytopes.js b/polytopes.js index 6ed7362..e37392b 100644 --- a/polytopes.js +++ b/polytopes.js @@ -133,6 +133,15 @@ export const tesseract = () => { scale_nodes(nodes, Math.sqrt(2) / 2); const links = auto_detect_edges(nodes, 4); + links.map((l) => { l.label = 0 }); + + for( const p of [ 1, 2 ] ) { + const nodes16 = nodes.filter((n) => n.label === p); + const links16 = auto_detect_edges(nodes16, 6); + links16.map((l) => l.label = p); + links.push(...links16); + } + return { name: 'tesseract', @@ -142,10 +151,10 @@ export const tesseract = () => { node_size: 0.02, link_size: 0.02 }, - base: {}, options: [ - [ 'One inscribed 16-cell', {} ], - [ 'Both inscribed 16-cells', {} ], + { name: 'normal', links: [ 0 ] }, + { name: 'one 16-cell', links: [ 0, 1 ] }, + { name: 'both 16-cells', links: [ 0, 1, 2 ] }, ], }; } @@ -785,3 +794,9 @@ export const dodecahedron_inscribed = () => dodecahedron_some_inscribed([1]); export const dodecahedron_all_inscribed = () => dodecahedron_some_inscribed([1,2,3,4,5]); +export const build_all = () => { + return [ + tesseract(), + cell120_inscribed() + ]; +} \ No newline at end of file