Added 600-cell and 120-cell

feature-120-cell-layers
Mike Lynch 2023-11-01 11:49:42 +11:00
parent 4bf38858ea
commit 029e6f3161
1 changed files with 19 additions and 59 deletions

View File

@ -393,28 +393,6 @@ function link_labels(nodes, link) {
export const cell120 = () => {
const nodes = make_120cell_vertices();
const links = auto_detect_edges(nodes, 4);
label_120cell(nodes);
return {
name: '120-cell',
nodes: nodes,
links: links,
geometry: {
node_size: 0.02,
link_size: 0.02
},
base: {},
options: [
[ 'One inscribed 600-cell', {} ],
[ 'All inscribed 600-cells', {} ],
]
}
}
export const cell120_layered = (max) => { export const cell120_layered = (max) => {
const nodes = make_120cell_vertices(); const nodes = make_120cell_vertices();
const links = auto_detect_edges(nodes, 4); const links = auto_detect_edges(nodes, 4);
@ -453,7 +431,7 @@ export const cell120_inscribed = () => {
} }
return { return {
name: '120-cell inscribed', name: '120-cell',
nodes: nodes, nodes: nodes,
links: links, links: links,
geometry: { geometry: {
@ -462,14 +440,12 @@ export const cell120_inscribed = () => {
}, },
options: [ options: [
{ name: "none", links: [ 0 ]}, { name: "none", links: [ 0 ]},
{ name: "one", links: [ 0, 1 ] }, { name: "one inscribed 600-cell", links: [ 0, 1 ] },
{ name: "all", links: [ 0, 1, 2, 3, 4, 5 ] } { name: "five inscribed 600-cells", links: [ 0, 1, 2, 3, 4, 5 ] }
] ]
} }
} }
// export const cell120_inscribed = () => cell120_some_inscribed([1]);
// export const cell120_all_inscribed = () => cell120_some_inscribed([1,2,3,4,5]);
// Schoute's partition via https://arxiv.org/abs/1010.4353 // Schoute's partition via https://arxiv.org/abs/1010.4353
@ -647,48 +623,31 @@ export const cell600 = () => {
const nodes = make_600cell_vertices(); const nodes = make_600cell_vertices();
const links = auto_detect_edges(nodes, 12); const links = auto_detect_edges(nodes, 12);
links.map((l) => l.label = 0);
for( const p of [1, 2, 3, 4, 5]) {
const nodes24 = nodes.filter((n) => n.label === p);
const links24 = auto_detect_edges(nodes24, 8);
links24.map((l) => l.label = p);
links.push(...links24);
}
return { return {
name: '600-cell',
nodes: nodes, nodes: nodes,
links: links, links: links,
geometry: {
node_size: 0.02,
link_size: 0.02
}
}
}
const cell600_some_inscribed = (ps) => {
const nodes = make_600cell_vertices();
const links = auto_detect_edges(nodes, 12);
const all_links = links;
all_links.map((l) => l.label = 0);
for( const p of ps) {
const nodes24 = nodes.filter((n) => n.label === p);
const links24 = auto_detect_edges(nodes24, 8);
links24.map((l) => l.label = p);
all_links.push(...links24);
}
return {
nodes: nodes,
links: all_links,
geometry: { geometry: {
node_size: 0.02, node_size: 0.02,
link_size: 0.02 link_size: 0.02
}, },
options: [
{ name: "none", links: [ 0 ]},
{ name: "one 24-cell", links: [ 0, 1 ] },
{ name: "five 24-cells", links: [ 0, 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]);
function make_dodecahedron_vertices() { function make_dodecahedron_vertices() {
const phi = 0.5 * (1 + Math.sqrt(5)); const phi = 0.5 * (1 + Math.sqrt(5));
const phiinv = 1 / phi; const phiinv = 1 / phi;
@ -771,6 +730,7 @@ export const build_all = () => {
cell16(), cell16(),
tesseract(), tesseract(),
cell24(), cell24(),
cell600(),
cell120_inscribed() cell120_inscribed()
]; ];
} }