Visualisations of combinations of layers
parent
8c256629b1
commit
944416f92b
3
gui.js
3
gui.js
|
@ -46,7 +46,8 @@ class FourDGUI {
|
||||||
|
|
||||||
this.gui.add(this.params, 'shape',
|
this.gui.add(this.params, 'shape',
|
||||||
[ 'dodecahedron', '5-cell', '16-cell', 'tesseract',
|
[ 'dodecahedron', '5-cell', '16-cell', 'tesseract',
|
||||||
'24-cell', '600-cell', '120-cell' ]
|
'24-cell', '600-cell', '120-cell',
|
||||||
|
'120-cell-a', '120-cell-b', '120-cell-c', '120-cell-d', '120-cell-e', '120-cell-f' ]
|
||||||
).onChange(changeShape)
|
).onChange(changeShape)
|
||||||
this.gui.add(this.params, 'inscribed').onChange(changeShape);
|
this.gui.add(this.params, 'inscribed').onChange(changeShape);
|
||||||
this.gui.add(this.params, 'inscribe_all').onChange(changeShape);
|
this.gui.add(this.params, 'inscribe_all').onChange(changeShape);
|
||||||
|
|
6
main.js
6
main.js
|
@ -69,6 +69,12 @@ const STRUCTURES = {
|
||||||
'24-cell': POLYTOPES.cell24(),
|
'24-cell': POLYTOPES.cell24(),
|
||||||
'dodecahedron': POLYTOPES.dodecahedron(),
|
'dodecahedron': POLYTOPES.dodecahedron(),
|
||||||
'120-cell': POLYTOPES.cell120(),
|
'120-cell': POLYTOPES.cell120(),
|
||||||
|
'120-cell-a': POLYTOPES.cell120_layered(1),
|
||||||
|
'120-cell-b': POLYTOPES.cell120_layered(2),
|
||||||
|
'120-cell-c': POLYTOPES.cell120_layered(3),
|
||||||
|
'120-cell-d': POLYTOPES.cell120_layered(4),
|
||||||
|
'120-cell-e': POLYTOPES.cell120_layered(5),
|
||||||
|
'120-cell-f': POLYTOPES.cell120_layered(6),
|
||||||
'600-cell': POLYTOPES.cell600(),
|
'600-cell': POLYTOPES.cell600(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
32
polytopes.js
32
polytopes.js
|
@ -332,6 +332,8 @@ function make_120cell_vertices() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function label_nodes(nodes, ids, label) {
|
function label_nodes(nodes, ids, label) {
|
||||||
nodes.filter((n) => ids.includes(n.id)).map((n) => n.label = label);
|
nodes.filter((n) => ids.includes(n.id)).map((n) => n.label = label);
|
||||||
}
|
}
|
||||||
|
@ -379,10 +381,12 @@ function label_120cell(nodes) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function layered_120cell(nodes) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function layered_120cell(nodes, max_layer) {
|
||||||
for (const cstr in CELL120.LAYERS ) {
|
for (const cstr in CELL120.LAYERS ) {
|
||||||
label_nodes(nodes, CELL120.LAYERS[cstr], Number(cstr));
|
label_nodes(nodes, CELL120.LAYERS[cstr], Number(cstr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -400,8 +404,7 @@ export const cell120 = () => {
|
||||||
const nodes = make_120cell_vertices();
|
const nodes = make_120cell_vertices();
|
||||||
const links = auto_detect_edges(nodes, 4);
|
const links = auto_detect_edges(nodes, 4);
|
||||||
|
|
||||||
//label_120cell(nodes);
|
label_120cell(nodes);
|
||||||
layered_120cell(nodes);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
nodes: nodes,
|
nodes: nodes,
|
||||||
|
@ -413,6 +416,27 @@ export const cell120 = () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const cell120_layered = (max) => {
|
||||||
|
const nodes = make_120cell_vertices();
|
||||||
|
const links = auto_detect_edges(nodes, 4);
|
||||||
|
|
||||||
|
layered_120cell(nodes);
|
||||||
|
|
||||||
|
const layer_nodes = nodes.filter((n) => n.label < max);
|
||||||
|
const layer_links = links.filter((l) => {
|
||||||
|
const labels = link_labels(nodes, l);
|
||||||
|
return labels[0] < max && labels[1] < max
|
||||||
|
});
|
||||||
|
|
||||||
|
return {
|
||||||
|
nodes: layer_nodes,
|
||||||
|
links: layer_links,
|
||||||
|
geometry: {
|
||||||
|
node_size: 0.02,
|
||||||
|
link_size: 0.02
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue