Compare commits
No commits in common. "bf8356b0a265c5894d372d599938670daf67850b" and "63b2f8f22e75b6034c89843accc017bf4eb93dea" have entirely different histories.
bf8356b0a2
...
63b2f8f22e
2
gui.js
2
gui.js
|
@ -45,7 +45,7 @@ class FourDGUI {
|
||||||
};
|
};
|
||||||
|
|
||||||
this.gui.add(this.params, 'shape',
|
this.gui.add(this.params, 'shape',
|
||||||
[ 'dodecahedron', '5-cell', '16-cell', 'tesseract',
|
[ '5-cell', '16-cell', 'tesseract',
|
||||||
'24-cell', '600-cell', '120-cell' ]
|
'24-cell', '600-cell', '120-cell' ]
|
||||||
).onChange(changeShape)
|
).onChange(changeShape)
|
||||||
this.gui.add(this.params, 'inscribed').onChange(changeShape);
|
this.gui.add(this.params, 'inscribed').onChange(changeShape);
|
||||||
|
|
|
@ -17,6 +17,6 @@
|
||||||
<body>
|
<body>
|
||||||
<script type="module" src="/main.js"></script>
|
<script type="module" src="/main.js"></script>
|
||||||
<div id="info">by <a target="_blank" href="https://mikelynch.org/">Mike Lynch</a> -
|
<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>
|
</body>
|
||||||
</html>
|
</html>
|
3
main.js
3
main.js
|
@ -64,7 +64,6 @@ 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(),
|
||||||
};
|
};
|
||||||
|
@ -74,7 +73,6 @@ const INSCRIBED = {
|
||||||
'24-cell': POLYTOPES.cell24_inscribed(),
|
'24-cell': POLYTOPES.cell24_inscribed(),
|
||||||
'120-cell': POLYTOPES.cell120_inscribed(),
|
'120-cell': POLYTOPES.cell120_inscribed(),
|
||||||
'600-cell': POLYTOPES.cell600_inscribed(),
|
'600-cell': POLYTOPES.cell600_inscribed(),
|
||||||
'dodecahedron': POLYTOPES.dodecahedron_inscribed(),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const ALL_INSCRIBED = {
|
const ALL_INSCRIBED = {
|
||||||
|
@ -82,7 +80,6 @@ const ALL_INSCRIBED = {
|
||||||
'24-cell': POLYTOPES.cell24_all_inscribed(),
|
'24-cell': POLYTOPES.cell24_all_inscribed(),
|
||||||
'120-cell': POLYTOPES.cell120_all_inscribed(),
|
'120-cell': POLYTOPES.cell120_all_inscribed(),
|
||||||
'600-cell': POLYTOPES.cell600_all_inscribed(),
|
'600-cell': POLYTOPES.cell600_all_inscribed(),
|
||||||
'dodecahedron': POLYTOPES.dodecahedron_all_inscribed(),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let shape = false;
|
let shape = false;
|
||||||
|
|
71
polytopes.js
71
polytopes.js
|
@ -652,52 +652,8 @@ const cell600_some_inscribed = (ps) => {
|
||||||
link_size: 0.02
|
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 {
|
return {
|
||||||
nodes: nodes,
|
nodes: nodes,
|
||||||
links: links,
|
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) {
|
export const cell600_inscribed = () => cell600_some_inscribed([1]);
|
||||||
const tetran = nodes.filter((n) => n.label === p);
|
export const cell600_all_inscribed = () => cell600_some_inscribed([1,2,3,4,5]);
|
||||||
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]);
|
|
||||||
|
|
||||||
|
|
50
testbed.js
50
testbed.js
|
@ -908,42 +908,24 @@ function check_120cell_nodes(nodes) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function make_dodecahedron_vertices() {
|
|
||||||
const phi = 0.5 * (1 + Math.sqrt(5));
|
|
||||||
const phiinv = 1 / phi;
|
|
||||||
|
|
||||||
const nodes = [
|
const nodes = make_120cell_vertices();
|
||||||
{ x: 1, y: 1, z: 1, w: 0 },
|
const links = auto_detect_edges(nodes, 4);
|
||||||
{ x: 1, y: 1, z: -1, w: 0 },
|
const faces = auto_120cell_faces(links);
|
||||||
{ x: 1, y: -1, z: 1, w: 0 },
|
|
||||||
{ x: 1, y: -1, z: -1, w: 0 },
|
|
||||||
{ x: -1, y: 1, z: 1, w: 0 },
|
console.log("Calculating 120-cell colours")
|
||||||
{ x: -1, y: 1, z: -1, w: 0 },
|
|
||||||
{ x: -1, y: -1, z: 1, w: 0 },
|
const a2 = arctic_two(nodes, links, faces, faces[0], 341)
|
||||||
{ x: -1, y: -1, z: -1, w: 0 }
|
|
||||||
].flat();
|
console.log(`got ${a2.dodecahedra.length}`);
|
||||||
scale_nodes(nodes, 0.5);
|
|
||||||
return nodes;
|
const labels = a2.labels;
|
||||||
|
|
||||||
|
console.log("labelling nodes");
|
||||||
|
for( const cstr in labels ) {
|
||||||
|
label_nodes(nodes, labels[cstr], Number(cstr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// const nodes = make_120cell_vertices();
|
|
||||||
// const links = auto_detect_edges(nodes, 4);
|
|
||||||
// const faces = auto_120cell_faces(links);
|
|
||||||
|
|
||||||
|
|
||||||
// console.log("Calculating 120-cell colours")
|
|
||||||
|
|
||||||
// const a2 = arctic_two(nodes, links, faces, faces[0], 341)
|
|
||||||
|
|
||||||
// console.log(`got ${a2.dodecahedra.length}`);
|
|
||||||
|
|
||||||
// const labels = a2.labels;
|
|
||||||
|
|
||||||
// console.log("labelling nodes");
|
|
||||||
// for( const cstr in labels ) {
|
|
||||||
// label_nodes(nodes, labels[cstr], Number(cstr));
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue