Refactored dodecahedron

feature-120-cell-layers
Mike Lynch 2023-11-01 11:52:48 +11:00
parent 029e6f3161
commit c481d24f3c
1 changed files with 17 additions and 28 deletions

View File

@ -685,48 +685,37 @@ function make_dodecahedron_vertices() {
export const dodecahedron = () => {
const nodes = make_dodecahedron_vertices();
const links = auto_detect_edges(nodes, 3);
links.map((l) => l.label = 0);
for( const p of [ 1, 2, 3, 4, 5 ]) {
const tetran = nodes.filter((n) => n.label === p);
const tetral = auto_detect_edges(tetran, 3);
tetral.map((l) => l.label = p);
links.push(...tetral);
}
return {
name: 'dodecahedron',
nodes: nodes,
links: links,
geometry: {
node_size: 0.02,
link_size: 0.02
}
}
}
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
},
options: [
{ name: "none", links: [ 0 ]},
{ name: "one tetrahedron", links: [ 0, 1 ] },
{ name: "five tetrahedra", links: [ 0, 1, 2, 3, 4, 5 ] }
]
}
}
export const dodecahedron_inscribed = () => dodecahedron_some_inscribed([1]);
export const dodecahedron_all_inscribed = () => dodecahedron_some_inscribed([1,2,3,4,5]);
export const build_all = () => {
return [
cell5(),
dodecahedron(),
cell5(),
cell16(),
tesseract(),
cell24(),