Compare commits

..

No commits in common. "029b14f53ae7116aefec64ad05da06f22b211f86" and "25a2c5ebe6b62f72fdf145c3a6867475effa8d80" have entirely different histories.

2 changed files with 9 additions and 10 deletions

11
gui.js
View File

@ -6,14 +6,14 @@ const DEFAULTS = {
nodesize: 1.25,
linkopacity: 0.5,
link2opacity: 0.5,
shape: '120-cell',
option: 'none',
shape: '',
option: '',
visibility: 5,
inscribed: false,
inscribe_all: false,
color: 0x3293a9,
background: 0xd4d4d4,
hyperplane: 1.5,
hyperplane: 2,
rotation: 'rigid',
dtheta: 0,
dpsi: 0,
@ -26,6 +26,9 @@ 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;
@ -61,7 +64,7 @@ class FourDGUI {
options_ctrl = this.gui.add(this.params, 'option', options).onChange((option) => {
setVisibility(option)
});
this.gui.add(this.params, 'hyperplane', 1.4, 2.4);
this.gui.add(this.params, 'hyperplane', 1.5, 2.25);
this.gui.add(this.params, 'thickness', 0.1, 2);
this.gui.add(this.params, 'linkopacity', 0, 1).onChange(
(v) => setLinkOpacity(v, true)

View File

@ -9,7 +9,6 @@ import { FourDShape } from './fourDShape.js';
import { get_colours } from './colours.js';
const FACE_OPACITY = 0.3;
const CAMERA_K = 10;
// scene, lights and camera
@ -24,7 +23,7 @@ scene.add(light);
const amblight = new THREE.AmbientLight(0xffffff, 0.5);
scene.add(amblight);
camera.position.set(0, 0, CAMERA_K / 2);
camera.position.set(0, 0, 4);
camera.lookAt(0, 0, 0);
//camera.position.z = 4;
@ -133,6 +132,7 @@ function setVisibility(option_name) {
}
gui = new FourDGUI(
STRUCTURES,
changeShape,
@ -200,14 +200,10 @@ 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();