From c883bd74062ef285ed5ddfdb17dd1208127ef7a3 Mon Sep 17 00:00:00 2001 From: Mike Lynch Date: Thu, 2 Nov 2023 14:13:45 +1100 Subject: [PATCH] Cleaned up some redundant old stuff --- polytopes.js | 51 ++++++++++----------------------------------------- 1 file changed, 10 insertions(+), 41 deletions(-) diff --git a/polytopes.js b/polytopes.js index fdc25c3..a19d326 100644 --- a/polytopes.js +++ b/polytopes.js @@ -348,43 +348,6 @@ function label_faces_120cell(nodes, faces, cfaces, label) { } -function basic_auto_label_120cell(nodes, links) { - - const faces = auto_120cell_faces(links); - const dodecas = DODECAHEDRA.DODECAHEDRA; - //const cfaces = [ 1, 2, 4, 145, 169 ]; - - let colour = 1; - for( const dd of dodecas ) { - label_faces_120cell(nodes, faces, dd, colour); - colour++; - if( colour > 8 ) { - colour = 1; - } - } - -} - -function label_120cell(nodes) { - - for( const cstr in CELL120.INDEX ) { - label_nodes(nodes, CELL120.INDEX[cstr], Number(cstr)); - } - -} - - - - - -function layered_120cell(nodes, max_layer) { - for (const cstr in CELL120.LAYERS ) { - label_nodes(nodes, CELL120.LAYERS[cstr], Number(cstr)); - } -} - - - function link_labels(nodes, link) { const n1 = nodes.filter((n) => n.id === link.source); const n2 = nodes.filter((n) => n.id === link.target); @@ -399,7 +362,11 @@ export const cell120_layered = (max) => { const nodes = make_120cell_vertices(); const links = auto_detect_edges(nodes, 4); - layered_120cell(nodes); + nodes.map((n) => n.label = 9); // make all invisible by default + + for (const cstr in CELL120.LAYERS ) { + label_nodes(nodes, CELL120.LAYERS[cstr], Number(cstr)); + } links.map((l) => { const labels = link_labels(nodes, l); @@ -413,9 +380,9 @@ export const cell120_layered = (max) => { const options = []; const layers = []; - for( const i of [ 0, 1, 2, 3, 4, 5, 6 ] ) { + for( const i of [ 0, 1, 2, 3, 4, 5, 6, 7 ] ) { layers.push(i); - options.push({ + options.unshift({ name: "Layer " + String(i), links: [...layers], nodes: [...layers] @@ -441,7 +408,9 @@ export const cell120_inscribed = () => { const nodes = make_120cell_vertices(); const links = auto_detect_edges(nodes, 4); - label_120cell(nodes); + for( const cstr in CELL120.INDEX ) { + label_nodes(nodes, CELL120.INDEX[cstr], Number(cstr)); + } links.map((l) => l.label = 0);