Added 24-cell
parent
50214adbe3
commit
4bf38858ea
33
polytopes.js
33
polytopes.js
|
@ -185,7 +185,14 @@ export const cell24 = () => {
|
|||
|
||||
index_nodes(nodes);
|
||||
const links = auto_detect_edges(nodes, 8);
|
||||
links.map((l) => l.label = 0);
|
||||
|
||||
for( const p of [ 1, 2, 3 ] ) {
|
||||
const nodes16 = nodes.filter((n) => n.label === p);
|
||||
const links16 = auto_detect_edges(nodes16, 6);
|
||||
links16.map((l) => l.label = p);
|
||||
links.push(...links16);
|
||||
}
|
||||
// links.map((l) => {
|
||||
// const ls = [ l.source, l.target ].map((nid) => node_by_id(nodes, nid).label);
|
||||
// for ( const c of [1, 2, 3] ) {
|
||||
|
@ -196,6 +203,7 @@ export const cell24 = () => {
|
|||
// });
|
||||
|
||||
return {
|
||||
name: '24-cell',
|
||||
nodes: nodes,
|
||||
links: links,
|
||||
geometry: {
|
||||
|
@ -204,32 +212,14 @@ export const cell24 = () => {
|
|||
},
|
||||
base: {},
|
||||
options: [
|
||||
[ 'One inscribed 16-cell', {} ],
|
||||
[ 'All inscribed 16-cells', {} ],
|
||||
{ name: 'none', links: [ 0 ] },
|
||||
{ name: 'one 16-cell', links: [ 0, 1 ] },
|
||||
{ name: 'three 16-cells', links: [ 0, 1, 2, 3 ] }
|
||||
]
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
const cell24_some_inscribed = (ps) => {
|
||||
const t = cell24();
|
||||
|
||||
const i_links = [];
|
||||
|
||||
for( const p of ps ) {
|
||||
const nodes16 = t.nodes.filter((n) => n.label === p);
|
||||
const links16 = auto_detect_edges(nodes16, 6);
|
||||
links16.map((l) => l.label = p);
|
||||
i_links.push(...links16);
|
||||
}
|
||||
|
||||
t.links.push(...i_links);
|
||||
return t;
|
||||
}
|
||||
|
||||
|
||||
export const cell24_inscribed = () => cell24_some_inscribed([1]);
|
||||
export const cell24_all_inscribed = () => cell24_some_inscribed([1,2,3]);
|
||||
|
||||
|
||||
|
||||
|
@ -780,6 +770,7 @@ export const build_all = () => {
|
|||
cell5(),
|
||||
cell16(),
|
||||
tesseract(),
|
||||
cell24(),
|
||||
cell120_inscribed()
|
||||
];
|
||||
}
|
Loading…
Reference in New Issue