Compare commits
No commits in common. "029b14f53ae7116aefec64ad05da06f22b211f86" and "25a2c5ebe6b62f72fdf145c3a6867475effa8d80" have entirely different histories.
029b14f53a
...
25a2c5ebe6
11
gui.js
11
gui.js
|
@ -6,14 +6,14 @@ const DEFAULTS = {
|
||||||
nodesize: 1.25,
|
nodesize: 1.25,
|
||||||
linkopacity: 0.5,
|
linkopacity: 0.5,
|
||||||
link2opacity: 0.5,
|
link2opacity: 0.5,
|
||||||
shape: '120-cell',
|
shape: '',
|
||||||
option: 'none',
|
option: '',
|
||||||
visibility: 5,
|
visibility: 5,
|
||||||
inscribed: false,
|
inscribed: false,
|
||||||
inscribe_all: false,
|
inscribe_all: false,
|
||||||
color: 0x3293a9,
|
color: 0x3293a9,
|
||||||
background: 0xd4d4d4,
|
background: 0xd4d4d4,
|
||||||
hyperplane: 1.5,
|
hyperplane: 2,
|
||||||
rotation: 'rigid',
|
rotation: 'rigid',
|
||||||
dtheta: 0,
|
dtheta: 0,
|
||||||
dpsi: 0,
|
dpsi: 0,
|
||||||
|
@ -26,6 +26,9 @@ class FourDGUI {
|
||||||
constructor(shapes, changeShape, setColor, setBackground, setLinkOpacity, setVisibility) {
|
constructor(shapes, changeShape, setColor, setBackground, setLinkOpacity, setVisibility) {
|
||||||
this.gui = new GUI();
|
this.gui = new GUI();
|
||||||
const SHAPE_NAMES = shapes.map((s) => s.name);
|
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();
|
this.parseLinkParams();
|
||||||
const guiObj = this;
|
const guiObj = this;
|
||||||
|
@ -61,7 +64,7 @@ class FourDGUI {
|
||||||
options_ctrl = this.gui.add(this.params, 'option', options).onChange((option) => {
|
options_ctrl = this.gui.add(this.params, 'option', options).onChange((option) => {
|
||||||
setVisibility(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, 'thickness', 0.1, 2);
|
||||||
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)
|
||||||
|
|
8
main.js
8
main.js
|
@ -9,7 +9,6 @@ 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;
|
|
||||||
|
|
||||||
// scene, lights and camera
|
// scene, lights and camera
|
||||||
|
|
||||||
|
@ -24,7 +23,7 @@ scene.add(light);
|
||||||
const amblight = new THREE.AmbientLight(0xffffff, 0.5);
|
const amblight = new THREE.AmbientLight(0xffffff, 0.5);
|
||||||
scene.add(amblight);
|
scene.add(amblight);
|
||||||
|
|
||||||
camera.position.set(0, 0, CAMERA_K / 2);
|
camera.position.set(0, 0, 4);
|
||||||
|
|
||||||
camera.lookAt(0, 0, 0);
|
camera.lookAt(0, 0, 0);
|
||||||
//camera.position.z = 4;
|
//camera.position.z = 4;
|
||||||
|
@ -133,6 +132,7 @@ function setVisibility(option_name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
gui = new FourDGUI(
|
gui = new FourDGUI(
|
||||||
STRUCTURES,
|
STRUCTURES,
|
||||||
changeShape,
|
changeShape,
|
||||||
|
@ -200,14 +200,10 @@ function animate() {
|
||||||
const rotations = get_rotation(gui.params.rotation, theta, psi);
|
const rotations = get_rotation(gui.params.rotation, theta, psi);
|
||||||
|
|
||||||
shape.hyperplane = gui.params.hyperplane;
|
shape.hyperplane = gui.params.hyperplane;
|
||||||
camera.position.set(0, 0, 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;
|
||||||
shape.render3(rotations, node_show, link_show);
|
shape.render3(rotations, node_show, link_show);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
renderer.render( scene, camera );
|
renderer.render( scene, camera );
|
||||||
}
|
}
|
||||||
animate();
|
animate();
|
||||||
|
|
Loading…
Reference in New Issue