Added basic automatic colour schemes and colourised the first

24-cell of the 600-cell
experiments-120-cell
Mike Lynch 2023-08-02 16:58:51 +10:00
parent c500957609
commit bf8824a43e
5 changed files with 21 additions and 4 deletions

8
colours.js 100644
View File

@ -0,0 +1,8 @@
import ColorScheme from 'color-scheme';
export const get_colours = () => {
var scheme = new ColorScheme;
scheme.from_hue(21).scheme('triade').variation('soft');
return scheme.colors().map((cs) => parseInt('0x' + cs));
}

View File

@ -6,6 +6,7 @@ import * as POLYTOPES from './polytopes.js';
import { rotfn } from './rotation.js';
import { FourDGUI } from './gui.js';
import { FourDShape } from './fourDShape.js';
import { get_colours } from './colours.js';
// scene, lights and camera
@ -30,8 +31,9 @@ document.body.appendChild( renderer.domElement );
scene.background = new THREE.Color(0x808080);
const material = new THREE.MeshStandardMaterial({ color: 0x3293a9 });
const node_colours = get_colours();
const node_ms = [ material ];
const node_ms = node_colours.map((c) => new THREE.MeshStandardMaterial({color: c}));
const link_ms = [ material ];

6
package-lock.json generated
View File

@ -5,6 +5,7 @@
"packages": {
"": {
"dependencies": {
"color-scheme": "^1.0.1",
"lil-gui": "^0.18.2",
"three": "^0.154.0"
},
@ -364,6 +365,11 @@
"node": ">=12"
}
},
"node_modules/color-scheme": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/color-scheme/-/color-scheme-1.0.1.tgz",
"integrity": "sha512-4x+ya6+z6g9DaTFSfVzTZc8TSjxHuDT40NB43N3XPUkQlF6uujhwH8aeMeq8HBgoQQog/vrYgJ16mt/eVTRXwQ=="
},
"node_modules/esbuild": {
"version": "0.18.15",
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.15.tgz",

View File

@ -1,5 +1,6 @@
{
"dependencies": {
"color-scheme": "^1.0.1",
"lil-gui": "^0.18.2",
"three": "^0.154.0"
},

View File

@ -176,9 +176,9 @@ function make_600cell_vertices() {
const nodes = [
PERMUTE.coordinates([0, 0, 0, 2], 0),
PERMUTE.coordinates([1, 1, 1, 1], 0),
PERMUTE.coordinates([1, 1, 1, 1], 1),
PERMUTE.coordinates([phi, 1, 1 / phi, 0], 0, true)
PERMUTE.coordinates([phi, 1, 1 / phi, 0], 1, true)
].flat();
return scale_and_index(nodes, 0.75);
}
@ -191,7 +191,7 @@ export const cell600 = () => {
nodes: nodes,
links: links,
geometry: {
node_size: 0.02,
node_size: 0.08,
link_size: 0.02
}
}