Played around with the hyperplane and zoom so that it all looks

better with unit radius normalisation
broken-cursed-links
Mike Lynch 2024-04-25 11:25:01 +10:00
parent f99901f1b0
commit 78ebb381ee
2 changed files with 9 additions and 9 deletions

12
gui.js
View File

@ -2,8 +2,8 @@ import { GUI } from 'lil-gui';
const DEFAULTS = { const DEFAULTS = {
thickness: 1.0, thickness: 0.5,
nodesize: 2.0, nodesize: 1.5,
linkopacity: 0.5, linkopacity: 0.5,
link2opacity: 0.5, link2opacity: 0.5,
shape: '120-cell', shape: '120-cell',
@ -13,10 +13,10 @@ const DEFAULTS = {
inscribe_all: false, inscribe_all: false,
color: 0x3293a9, color: 0x3293a9,
background: 0xd4d4d4, background: 0xd4d4d4,
hyperplane: 1.5, hyperplane: 0.93,
zoom: 1, zoom: 1,
xRotate: 'YW', xRotate: 'YW',
yRotate: 'XZ', yRotate: 'XW',
dtheta: 0, dtheta: 0,
dpsi: 0, dpsi: 0,
} }
@ -65,9 +65,9 @@ class FourDGUI {
options_ctrl = this.gui.add(this.params, 'option').options(options).onChange((option) => { options_ctrl = this.gui.add(this.params, 'option').options(options).onChange((option) => {
setVisibility(option) setVisibility(option)
}); });
this.gui.add(this.params, 'hyperplane', 1.4, 2.0); this.gui.add(this.params, 'hyperplane', 0.5, 1 / 0.8);
this.gui.add(this.params, 'zoom', 0.1, 2.0); this.gui.add(this.params, 'zoom', 0.1, 2.0);
this.gui.add(this.params, 'thickness', 0, 2); this.gui.add(this.params, 'thickness', 0, 1);
this.gui.add(this.params, 'linkopacity', 0, 1).onChange( this.gui.add(this.params, 'linkopacity', 0, 1).onChange(
(v) => setLinkOpacity(v, true) (v) => setLinkOpacity(v, true)
); );

View File

@ -9,7 +9,7 @@ import { FourDShape } from './fourDShape.js';
import { get_colours } from './colours.js'; import { get_colours } from './colours.js';
const FACE_OPACITY = 0.3; const FACE_OPACITY = 0.3;
const CAMERA_K = 10; const CAMERA_K = 5;
// scene, lights and camera // scene, lights and camera
@ -213,8 +213,8 @@ function animate() {
rotfn[gui.params.xRotate](theta), rotfn[gui.params.xRotate](theta),
rotfn[gui.params.yRotate](psi) rotfn[gui.params.yRotate](psi)
]; ];
shape.hyperplane = gui.params.hyperplane; shape.hyperplane = 1 / gui.params.hyperplane;
camera.position.set(0, 0, gui.params.zoom * CAMERA_K / gui.params.hyperplane); camera.position.set(0, 0, gui.params.zoom * CAMERA_K * gui.params.hyperplane);
shape.link_scale = gui.params.thickness; shape.link_scale = gui.params.thickness;
shape.node_scale = gui.params.nodesize; shape.node_scale = gui.params.nodesize;