added a dodecahedron
parent
63b2f8f22e
commit
fb8067a13e
2
gui.js
2
gui.js
|
@ -46,7 +46,7 @@ class FourDGUI {
|
||||||
|
|
||||||
this.gui.add(this.params, 'shape',
|
this.gui.add(this.params, 'shape',
|
||||||
[ '5-cell', '16-cell', 'tesseract',
|
[ '5-cell', '16-cell', 'tesseract',
|
||||||
'24-cell', '600-cell', '120-cell' ]
|
'24-cell', '600-cell', '120-cell', 'dodecahedron' ]
|
||||||
).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);
|
||||||
|
|
1
main.js
1
main.js
|
@ -64,6 +64,7 @@ const STRUCTURES = {
|
||||||
'16-cell': POLYTOPES.cell16(),
|
'16-cell': POLYTOPES.cell16(),
|
||||||
'tesseract': POLYTOPES.tesseract(),
|
'tesseract': POLYTOPES.tesseract(),
|
||||||
'24-cell': POLYTOPES.cell24(),
|
'24-cell': POLYTOPES.cell24(),
|
||||||
|
'dodecahedron': POLYTOPES.dodecahedron(),
|
||||||
'120-cell': POLYTOPES.cell120(),
|
'120-cell': POLYTOPES.cell120(),
|
||||||
'600-cell': POLYTOPES.cell600(),
|
'600-cell': POLYTOPES.cell600(),
|
||||||
};
|
};
|
||||||
|
|
51
polytopes.js
51
polytopes.js
|
@ -668,3 +668,54 @@ const cell600_some_inscribed = (ps) => {
|
||||||
export const cell600_inscribed = () => cell600_some_inscribed([1]);
|
export const cell600_inscribed = () => cell600_some_inscribed([1]);
|
||||||
export const cell600_all_inscribed = () => cell600_some_inscribed([1,2,3,4,5]);
|
export const cell600_all_inscribed = () => cell600_some_inscribed([1,2,3,4,5]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function make_dodecahedron_vertices() {
|
||||||
|
const phi = 0.5 * (1 + Math.sqrt(5));
|
||||||
|
const phiinv = 1 / phi;
|
||||||
|
|
||||||
|
const nodes = [
|
||||||
|
{ x: 1, y: 1, z: 1, w: 0 },
|
||||||
|
{ x: 1, y: 1, z: -1, w: 0 },
|
||||||
|
{ x: 1, y: -1, z: 1, w: 0 },
|
||||||
|
{ x: 1, y: -1, z: -1, w: 0 },
|
||||||
|
|
||||||
|
{ x: -1, y: 1, z: 1, w: 0 },
|
||||||
|
{ x: -1, y: 1, z: -1, w: 0 },
|
||||||
|
{ x: -1, y: -1, z: 1, w: 0 },
|
||||||
|
{ x: -1, y: -1, z: -1, w: 0 },
|
||||||
|
|
||||||
|
{ x: 0, y: phi, z: phiinv, w: 0 },
|
||||||
|
{ x: 0, y: phi, z: -phiinv, w: 0 },
|
||||||
|
{ x: 0, y: -phi, z: phiinv, w: 0 },
|
||||||
|
{ x: 0, y: -phi, z: -phiinv, w: 0 },
|
||||||
|
|
||||||
|
{ x: phiinv, y: 0, z: phi, w: 0 },
|
||||||
|
{ x: phiinv, y: 0, z: -phi, w: 0 },
|
||||||
|
{ x: -phiinv, y: 0, z: phi, w: 0 },
|
||||||
|
{ x: -phiinv, y: 0, z: -phi, w: 0 },
|
||||||
|
|
||||||
|
{ x: phi, y: phiinv, z:0, w: 0 },
|
||||||
|
{ x: phi, y: -phiinv, z:0, w: 0 },
|
||||||
|
{ x: -phi, y: phiinv, z:0, w: 0 },
|
||||||
|
{ x: -phi, y: -phiinv, z:0, w: 0 },
|
||||||
|
];
|
||||||
|
index_nodes(nodes);;
|
||||||
|
return nodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const dodecahedron = () => {
|
||||||
|
const nodes = make_dodecahedron_vertices();
|
||||||
|
const links = auto_detect_edges(nodes, 3);
|
||||||
|
|
||||||
|
return {
|
||||||
|
nodes: nodes,
|
||||||
|
links: links,
|
||||||
|
geometry: {
|
||||||
|
node_size: 0.02,
|
||||||
|
link_size: 0.02
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
40
testbed.js
40
testbed.js
|
@ -907,25 +907,43 @@ function check_120cell_nodes(nodes) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function make_dodecahedron_vertices() {
|
||||||
|
const phi = 0.5 * (1 + Math.sqrt(5));
|
||||||
|
const phiinv = 1 / phi;
|
||||||
|
|
||||||
|
const nodes = [
|
||||||
|
{ x: 1, y: 1, z: 1, w: 0 },
|
||||||
|
{ x: 1, y: 1, z: -1, w: 0 },
|
||||||
|
{ x: 1, y: -1, z: 1, w: 0 },
|
||||||
|
{ x: 1, y: -1, z: -1, w: 0 },
|
||||||
|
{ x: -1, y: 1, z: 1, w: 0 },
|
||||||
|
{ x: -1, y: 1, z: -1, w: 0 },
|
||||||
|
{ x: -1, y: -1, z: 1, w: 0 },
|
||||||
|
{ x: -1, y: -1, z: -1, w: 0 }
|
||||||
|
].flat();
|
||||||
|
scale_nodes(nodes, 0.5);
|
||||||
|
return nodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const nodes = make_120cell_vertices();
|
// const nodes = make_120cell_vertices();
|
||||||
const links = auto_detect_edges(nodes, 4);
|
// const links = auto_detect_edges(nodes, 4);
|
||||||
const faces = auto_120cell_faces(links);
|
// const faces = auto_120cell_faces(links);
|
||||||
|
|
||||||
|
|
||||||
console.log("Calculating 120-cell colours")
|
// console.log("Calculating 120-cell colours")
|
||||||
|
|
||||||
const a2 = arctic_two(nodes, links, faces, faces[0], 341)
|
// const a2 = arctic_two(nodes, links, faces, faces[0], 341)
|
||||||
|
|
||||||
console.log(`got ${a2.dodecahedra.length}`);
|
// console.log(`got ${a2.dodecahedra.length}`);
|
||||||
|
|
||||||
const labels = a2.labels;
|
// const labels = a2.labels;
|
||||||
|
|
||||||
console.log("labelling nodes");
|
// console.log("labelling nodes");
|
||||||
for( const cstr in labels ) {
|
// for( const cstr in labels ) {
|
||||||
label_nodes(nodes, labels[cstr], Number(cstr));
|
// label_nodes(nodes, labels[cstr], Number(cstr));
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue