From e7cb1856e0920bdad4c0c0fd235d2745f9b7f3fb Mon Sep 17 00:00:00 2001 From: Mike Lynch Date: Thu, 2 Nov 2023 16:26:48 +1100 Subject: [PATCH 1/2] Added a flag to turn off link2opacity for layered 120-cell --- main.js | 10 ++++++---- polytopes.js | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/main.js b/main.js index f12bfdc..8f1c524 100644 --- a/main.js +++ b/main.js @@ -103,11 +103,13 @@ function setBackground(c) { } function setLinkOpacity(o, primary) { - if( primary ) { - link_ms[0].opacity = o; + if( structure.nolink2opacity ) { + link_ms.map((lm) => lm.opacity = o); } else { - for( const lm of link_ms.slice(1) ) { - lm.opacity = o; + if( primary ) { + link_ms[0].opacity = o; + } else { + link_ms.slice(1).map((lm) => lm.opacity = o); } } } diff --git a/polytopes.js b/polytopes.js index a19d326..22ed9ff 100644 --- a/polytopes.js +++ b/polytopes.js @@ -397,6 +397,7 @@ export const cell120_layered = (max) => { node_size: 0.02, link_size: 0.02 }, + nolink2opacity: true, options: options } } @@ -598,7 +599,6 @@ function get_node(nodes, id) { } function audit_link_labels(nodes, links) { - console.log("Link audit"); for( const l of links ) { const n1 = get_node(nodes, l.source); const n2 = get_node(nodes, l.target); From 46dfb808f4e6ea7bb039a0a6a8f766998553c535 Mon Sep 17 00:00:00 2001 From: Mike Lynch Date: Thu, 2 Nov 2023 16:36:18 +1100 Subject: [PATCH 2/2] Added better layer names --- main.js | 2 +- polytopes.js | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/main.js b/main.js index 8f1c524..891f3ad 100644 --- a/main.js +++ b/main.js @@ -114,7 +114,7 @@ function setLinkOpacity(o, primary) { } } -let gui; // +let gui; function changeShape() { diff --git a/polytopes.js b/polytopes.js index 22ed9ff..aceeb25 100644 --- a/polytopes.js +++ b/polytopes.js @@ -359,6 +359,16 @@ function link_labels(nodes, link) { // layer and the links follow that export const cell120_layered = (max) => { + const LAYER_NAMES = { + 0: "North pole", + 1: "Arctic circle", + 2: "North temperate", + 3: "Tropic of Cancer", + 4: "Equator", + 5: "Tropic of Capricorn", + 6: "South temperate", + 7: "Antarctic circle (all)" + }; const nodes = make_120cell_vertices(); const links = auto_detect_edges(nodes, 4); @@ -382,8 +392,8 @@ export const cell120_layered = (max) => { for( const i of [ 0, 1, 2, 3, 4, 5, 6, 7 ] ) { layers.push(i); - options.unshift({ - name: "Layer " + String(i), + options.push({ + name: LAYER_NAMES[i], links: [...layers], nodes: [...layers] })