From 0433267e620ca2ee67cfa6e2d1101a9379060455 Mon Sep 17 00:00:00 2001 From: Mike Lynch Date: Fri, 4 Aug 2023 15:04:52 +1000 Subject: [PATCH] further colour tweaks --- colours.js | 3 +-- gui.js | 2 +- main.js | 3 ++- polytopes.js | 22 +++++++++++++++++++++- 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/colours.js b/colours.js index c565707..1224d8f 100644 --- a/colours.js +++ b/colours.js @@ -3,8 +3,7 @@ import ColorScheme from 'color-scheme'; export const get_colours = (basis) => { const scheme = new ColorScheme; const hexbasis = basis.toString(16).padStart(6, "0"); - scheme.from_hex(hexbasis).scheme('analogic').variation('hard').distance(0.1); - console.log(scheme.colors()); + scheme.from_hex(hexbasis).scheme("triade").variation("hard").distance(0.5); return scheme.colors().map((cs) => parseInt('0x' + cs)); } diff --git a/gui.js b/gui.js index 54cb0df..ac5e22c 100644 --- a/gui.js +++ b/gui.js @@ -16,7 +16,7 @@ class FourDGUI { this.params = { shape: this.link['shape'] || DEFAULT_SHAPE, thickness: this.link['thickness'] || 1, - nodesize: this.link['nodesize'] || 0, + nodesize: this.link['nodesize'] || 2, color: this.link['color'] || DEFAULT_COLOR, background: this.link['background'] || DEFAULT_BG, hyperplane: this.link['hyperplane'] || 2, diff --git a/main.js b/main.js index 6a6d808..f0d0143 100644 --- a/main.js +++ b/main.js @@ -32,7 +32,8 @@ document.body.appendChild( renderer.domElement ); scene.background = new THREE.Color(0x808080); const material = new THREE.MeshStandardMaterial({ color: 0x3293a9 }); const node_colours = get_colours(0x3293a9); -console.log(node_colours); + + const node_ms = node_colours.map((c) => new THREE.MeshStandardMaterial({color: c})); const link_ms = [ material ]; diff --git a/polytopes.js b/polytopes.js index 1894142..36f3026 100644 --- a/polytopes.js +++ b/polytopes.js @@ -314,7 +314,7 @@ function make_600cell_vertices() { ].flat(); for( const n of nodes ) { - n.label = label_vertex(n, coords, partition600); + n.label = label_vertex(n, coords, partition600) - 1; } for( const n of nodes ) { @@ -329,12 +329,32 @@ function make_600cell_vertices() { return nodes; } +function get_node(nodes, id) { + const ns = nodes.filter((n) => n.id === id); + if( ns ) { + return ns[0] + } else { + return undefined; + } +} + +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); + if( n1.label === n2.label ) { + console.log(`link ${l.id} joins ${n1.id} ${n2.id} with label ${n2.label}`); + } + } +} export const cell600 = () => { const nodes = make_600cell_vertices(); const links = auto_detect_edges(nodes, 12); + return { nodes: nodes, links: links,