Generated the vertices of the 24-cell
parent
23f246d781
commit
16d949a394
5
main.js
5
main.js
|
@ -192,7 +192,6 @@ scene.add(amblight);
|
|||
scene.background = new THREE.Color(0xdddddd);
|
||||
|
||||
const renderer = new THREE.WebGLRenderer({antialias: true});
|
||||
//renderer.physicallyCorrectLights = true;
|
||||
renderer.setSize( window.innerWidth, window.innerHeight );
|
||||
document.body.appendChild( renderer.domElement );
|
||||
|
||||
|
@ -210,9 +209,9 @@ link_m.roughness = 0.0;
|
|||
link_m.transparent = true;
|
||||
link_m.opacity = 0.5;
|
||||
|
||||
console.log(SHAPES.TESSERACT);
|
||||
const struct = SHAPES.cell24();
|
||||
|
||||
const shape = new FourDShape(node_m, link_m, SHAPES.TESSERACT);
|
||||
const shape = new FourDShape(node_m, link_m, struct);
|
||||
|
||||
scene.add(shape);
|
||||
|
||||
|
|
24
shapes.js
24
shapes.js
|
@ -124,4 +124,28 @@ export const TESSERACT = {
|
|||
]
|
||||
};
|
||||
|
||||
export const cell24 = () => {
|
||||
const structure = {
|
||||
nodes: [],
|
||||
links: []
|
||||
};
|
||||
const axes = [ 'x', 'y', 'z', 'w' ];
|
||||
let i = 1;
|
||||
for ( let p = 0; p < 3; p++ ) {
|
||||
for ( let q = p + 1; q < 4; q++ ) {
|
||||
const a1 = axes[p];
|
||||
const a2 = axes[q];
|
||||
for ( const v1 of [ -1, 1 ] ) {
|
||||
for ( const v2 of [ -1, 1 ] ) {
|
||||
const node = { id: i, x: 0, y: 0, z: 0, w:0 };
|
||||
node[a1] = v1;
|
||||
node[a2] = v2;
|
||||
structure.nodes.push(node);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return structure;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue