diff --git a/gui.js b/gui.js index 410084a..08a7bdd 100644 --- a/gui.js +++ b/gui.js @@ -6,14 +6,14 @@ const DEFAULTS = { nodesize: 1.25, linkopacity: 0.5, link2opacity: 0.5, - shape: '', - option: '', + shape: '120-cell', + option: 'none', visibility: 5, inscribed: false, inscribe_all: false, color: 0x3293a9, background: 0xd4d4d4, - hyperplane: 2, + hyperplane: 1.5, rotation: 'rigid', dtheta: 0, dpsi: 0, @@ -26,9 +26,6 @@ class FourDGUI { constructor(shapes, changeShape, setColor, setBackground, setLinkOpacity, setVisibility) { this.gui = new GUI(); const SHAPE_NAMES = shapes.map((s) => s.name); - // set default shape + option from the first shape - DEFAULTS.shape = shapes[0].name; - DEFAULTS.option = shapes[0].options[0].name; this.parseLinkParams(); const guiObj = this; @@ -64,7 +61,7 @@ class FourDGUI { options_ctrl = this.gui.add(this.params, 'option', options).onChange((option) => { setVisibility(option) }); - this.gui.add(this.params, 'hyperplane', 1.5, 2.25); + this.gui.add(this.params, 'hyperplane', 1.4, 2.4); this.gui.add(this.params, 'thickness', 0.1, 2); this.gui.add(this.params, 'linkopacity', 0, 1).onChange( (v) => setLinkOpacity(v, true) diff --git a/main.js b/main.js index 891f3ad..02ba6dc 100644 --- a/main.js +++ b/main.js @@ -9,6 +9,7 @@ import { FourDShape } from './fourDShape.js'; import { get_colours } from './colours.js'; const FACE_OPACITY = 0.3; +const CAMERA_K = 10; // scene, lights and camera @@ -23,7 +24,7 @@ scene.add(light); const amblight = new THREE.AmbientLight(0xffffff, 0.5); scene.add(amblight); -camera.position.set(0, 0, 4); +camera.position.set(0, 0, CAMERA_K / 2); camera.lookAt(0, 0, 0); //camera.position.z = 4; @@ -132,7 +133,6 @@ function setVisibility(option_name) { } - gui = new FourDGUI( STRUCTURES, changeShape, @@ -200,10 +200,14 @@ function animate() { const rotations = get_rotation(gui.params.rotation, theta, psi); shape.hyperplane = gui.params.hyperplane; + camera.position.set(0, 0, CAMERA_K / gui.params.hyperplane); + shape.link_scale = gui.params.thickness; shape.node_scale = gui.params.nodesize; shape.render3(rotations, node_show, link_show); + + renderer.render( scene, camera ); } animate();