Fixed some scale problems
parent
e478abe7c6
commit
fb9c78d82f
|
@ -15,10 +15,8 @@ class FourDShape extends THREE.Group {
|
||||||
this.nodes3 = {};
|
this.nodes3 = {};
|
||||||
this.links = structure.links;
|
this.links = structure.links;
|
||||||
this.faces = ( "faces" in structure ) ? structure.faces : [];
|
this.faces = ( "faces" in structure ) ? structure.faces : [];
|
||||||
this.node_size = structure.geometry.node_size;
|
this.node_scale = structure.geometry.node_size;
|
||||||
this.link_size = structure.geometry.link_size;
|
this.link_scale = structure.geometry.link_size;
|
||||||
this.node_scale = 1;
|
|
||||||
this.link_scale = 1;
|
|
||||||
this.hyperplane = HYPERPLANE;
|
this.hyperplane = HYPERPLANE;
|
||||||
this.initShapes();
|
this.initShapes();
|
||||||
}
|
}
|
||||||
|
@ -51,7 +49,7 @@ class FourDShape extends THREE.Group {
|
||||||
const length = n1.v3.distanceTo(n2.v3);
|
const length = n1.v3.distanceTo(n2.v3);
|
||||||
const centre = new THREE.Vector3();
|
const centre = new THREE.Vector3();
|
||||||
centre.lerpVectors(n1.v3, n2.v3, 0.5);
|
centre.lerpVectors(n1.v3, n2.v3, 0.5);
|
||||||
const geometry = new THREE.CylinderGeometry(this.link_size * s2, this.link_size * s1, 1);
|
const geometry = new THREE.CylinderGeometry(this.link_scale * s2, this.link_scale * s1, 1);
|
||||||
const cyl = new THREE.Mesh(geometry, material);
|
const cyl = new THREE.Mesh(geometry, material);
|
||||||
const edge = new THREE.Group();
|
const edge = new THREE.Group();
|
||||||
edge.add(cyl);
|
edge.add(cyl);
|
||||||
|
@ -71,7 +69,7 @@ class FourDShape extends THREE.Group {
|
||||||
const length = n1.v3.distanceTo(n2.v3);
|
const length = n1.v3.distanceTo(n2.v3);
|
||||||
const centre = new THREE.Vector3();
|
const centre = new THREE.Vector3();
|
||||||
centre.lerpVectors(n1.v3, n2.v3, 0.5);
|
centre.lerpVectors(n1.v3, n2.v3, 0.5);
|
||||||
link.object.scale.copy(new THREE.Vector3(this.link_size * s2, this.link_size * s1, length));
|
link.object.scale.copy(new THREE.Vector3(this.link_scale * s2, this.link_scale * s1, length));
|
||||||
link.object.position.copy(centre);
|
link.object.position.copy(centre);
|
||||||
link.object.lookAt(n2.v3);
|
link.object.lookAt(n2.v3);
|
||||||
link.object.children[0].rotation.x = Math.PI / 2.0;
|
link.object.children[0].rotation.x = Math.PI / 2.0;
|
||||||
|
|
6
gui.js
6
gui.js
|
@ -2,8 +2,8 @@ import { GUI } from 'lil-gui';
|
||||||
|
|
||||||
|
|
||||||
const DEFAULTS = {
|
const DEFAULTS = {
|
||||||
thickness: 0.5,
|
thickness: 0.02,
|
||||||
nodesize: 1.5,
|
nodesize: 0.02,
|
||||||
linkopacity: 0.5,
|
linkopacity: 0.5,
|
||||||
link2opacity: 0.5,
|
link2opacity: 0.5,
|
||||||
shape: '120-cell',
|
shape: '120-cell',
|
||||||
|
@ -74,7 +74,7 @@ class FourDGUI {
|
||||||
this.gui.add(this.params, 'link2opacity', 0, 1).onChange(
|
this.gui.add(this.params, 'link2opacity', 0, 1).onChange(
|
||||||
(v) => setLinkOpacity(v, false)
|
(v) => setLinkOpacity(v, false)
|
||||||
);
|
);
|
||||||
this.gui.add(this.params, 'nodesize', 0.1, 4);
|
this.gui.add(this.params, 'nodesize', 0, 1);
|
||||||
this.gui.addColor(this.params, 'color').onChange(setColor);
|
this.gui.addColor(this.params, 'color').onChange(setColor);
|
||||||
this.gui.addColor(this.params, 'background').onChange(setBackground);
|
this.gui.addColor(this.params, 'background').onChange(setBackground);
|
||||||
this.gui.add(this.params, 'xRotate', [ 'YW', 'YZ', 'ZW' ]);
|
this.gui.add(this.params, 'xRotate', [ 'YW', 'YZ', 'ZW' ]);
|
||||||
|
|
Loading…
Reference in New Issue