Compare commits

..

No commits in common. "bf8356b0a265c5894d372d599938670daf67850b" and "63b2f8f22e75b6034c89843accc017bf4eb93dea" have entirely different histories.

5 changed files with 15 additions and 103 deletions

2
gui.js
View File

@ -45,7 +45,7 @@ class FourDGUI {
};
this.gui.add(this.params, 'shape',
[ 'dodecahedron', '5-cell', '16-cell', 'tesseract',
[ '5-cell', '16-cell', 'tesseract',
'24-cell', '600-cell', '120-cell' ]
).onChange(changeShape)
this.gui.add(this.params, 'inscribed').onChange(changeShape);

View File

@ -17,6 +17,6 @@
<body>
<script type="module" src="/main.js"></script>
<div id="info">by <a target="_blank" href="https://mikelynch.org/">Mike Lynch</a> -
<a target="_blank" href="https://git.tilde.town/bombinans/fourdjs">source</a></div>
<a target="_blank" href="https://github.com/spikelynch/fourdjs">source</a></div>
</body>
</html>

View File

@ -64,7 +64,6 @@ const STRUCTURES = {
'16-cell': POLYTOPES.cell16(),
'tesseract': POLYTOPES.tesseract(),
'24-cell': POLYTOPES.cell24(),
'dodecahedron': POLYTOPES.dodecahedron(),
'120-cell': POLYTOPES.cell120(),
'600-cell': POLYTOPES.cell600(),
};
@ -74,7 +73,6 @@ const INSCRIBED = {
'24-cell': POLYTOPES.cell24_inscribed(),
'120-cell': POLYTOPES.cell120_inscribed(),
'600-cell': POLYTOPES.cell600_inscribed(),
'dodecahedron': POLYTOPES.dodecahedron_inscribed(),
};
const ALL_INSCRIBED = {
@ -82,7 +80,6 @@ const ALL_INSCRIBED = {
'24-cell': POLYTOPES.cell24_all_inscribed(),
'120-cell': POLYTOPES.cell120_all_inscribed(),
'600-cell': POLYTOPES.cell600_all_inscribed(),
'dodecahedron': POLYTOPES.dodecahedron_all_inscribed(),
}
let shape = false;

View File

@ -652,52 +652,8 @@ const cell600_some_inscribed = (ps) => {
link_size: 0.02
},
}
}
export const cell600_inscribed = () => cell600_some_inscribed([1]);
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, label: 4 },
{ x: 1, y: 1, z: -1, w: 0, label: 3 },
{ x: 1, y: -1, z: 1, w: 0, label: 3 },
{ x: 1, y: -1, z: -1, w: 0, label: 2 },
{ x: -1, y: 1, z: 1, w: 0, label: 3 },
{ x: -1, y: 1, z: -1, w: 0, label: 1 },
{ x: -1, y: -1, z: 1, w: 0, label: 5 },
{ x: -1, y: -1, z: -1, w: 0, label: 3 },
{ x: 0, y: phi, z: phiinv, w: 0, label: 5 },
{ x: 0, y: phi, z: -phiinv, w: 0 , label: 2 },
{ x: 0, y: -phi, z: phiinv, w: 0, label: 4 },
{ x: 0, y: -phi, z: -phiinv, w: 0 , label: 1 },
{ x: phiinv, y: 0, z: phi, w: 0 , label: 2},
{ x: phiinv, y: 0, z: -phi, w: 0 , label: 4},
{ x: -phiinv, y: 0, z: phi, w: 0 , label: 1},
{ x: -phiinv, y: 0, z: -phi, w: 0 , label: 5},
{ x: phi, y: phiinv, z:0, w: 0 , label: 1},
{ x: phi, y: -phiinv, z:0, w: 0 , label: 5},
{ x: -phi, y: phiinv, z:0, w: 0 , label: 4},
{ x: -phi, y: -phiinv, z:0, w: 0 , label: 2},
];
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,
@ -708,30 +664,7 @@ export const dodecahedron = () => {
}
}
const dodecahedron_some_inscribed = (ps) => {
const nodes = make_dodecahedron_vertices();
const links = auto_detect_edges(nodes, 3);
const all_links = links;
all_links.map((l) => l.label = 0);
for( const p of ps) {
const tetran = nodes.filter((n) => n.label === p);
const tetral = auto_detect_edges(tetran, 3);
tetral.map((l) => l.label = p);
all_links.push(...tetral);
}
return {
nodes: nodes,
links: all_links,
geometry: {
node_size: 0.02,
link_size: 0.02
},
}
}
export const dodecahedron_inscribed = () => dodecahedron_some_inscribed([1]);
export const dodecahedron_all_inscribed = () => dodecahedron_some_inscribed([1,2,3,4,5]);
export const cell600_inscribed = () => cell600_some_inscribed([1]);
export const cell600_all_inscribed = () => cell600_some_inscribed([1,2,3,4,5]);

View File

@ -907,43 +907,25 @@ 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 links = auto_detect_edges(nodes, 4);
// const faces = auto_120cell_faces(links);
const nodes = make_120cell_vertices();
const links = auto_detect_edges(nodes, 4);
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");
// for( const cstr in labels ) {
// label_nodes(nodes, labels[cstr], Number(cstr));
// }
console.log("labelling nodes");
for( const cstr in labels ) {
label_nodes(nodes, labels[cstr], Number(cstr));
}