From c481d24f3c2acd910a77b2d5ee56434556d18b9c Mon Sep 17 00:00:00 2001 From: Mike Lynch Date: Wed, 1 Nov 2023 11:52:48 +1100 Subject: [PATCH] Refactored dodecahedron --- polytopes.js | 45 +++++++++++++++++---------------------------- 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/polytopes.js b/polytopes.js index a28b2c5..f2a4d4e 100644 --- a/polytopes.js +++ b/polytopes.js @@ -685,48 +685,37 @@ function make_dodecahedron_vertices() { export const dodecahedron = () => { const nodes = make_dodecahedron_vertices(); const links = auto_detect_edges(nodes, 3); + links.map((l) => l.label = 0); + + for( const p of [ 1, 2, 3, 4, 5 ]) { + const tetran = nodes.filter((n) => n.label === p); + const tetral = auto_detect_edges(tetran, 3); + tetral.map((l) => l.label = p); + links.push(...tetral); + } return { + name: 'dodecahedron', nodes: nodes, links: links, - geometry: { - node_size: 0.02, - link_size: 0.02 - } - } -} - -const dodecahedron_some_inscribed = (ps) => { - const nodes = make_dodecahedron_vertices(); - const links = auto_detect_edges(nodes, 3); - const all_links = links; - all_links.map((l) => l.label = 0); - - for( const p of ps) { - const tetran = nodes.filter((n) => n.label === p); - const tetral = auto_detect_edges(tetran, 3); - tetral.map((l) => l.label = p); - all_links.push(...tetral); - } - - return { - nodes: nodes, - links: all_links, geometry: { node_size: 0.02, link_size: 0.02 }, + options: [ + { name: "none", links: [ 0 ]}, + { name: "one tetrahedron", links: [ 0, 1 ] }, + { name: "five tetrahedra", links: [ 0, 1, 2, 3, 4, 5 ] } + ] + } } -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 [ - cell5(), + dodecahedron(), + cell5(), cell16(), tesseract(), cell24(),