Inscriptions of 16-cells in 24-cell

feature-3d-shapes
Mike Lynch 2023-09-09 17:50:43 +10:00
parent 7c49116bba
commit 229218ec40
2 changed files with 32 additions and 8 deletions

View File

@ -70,12 +70,14 @@ const STRUCTURES = {
const INSCRIBED = { const INSCRIBED = {
'tesseract': POLYTOPES.tesseract_inscribed(), 'tesseract': POLYTOPES.tesseract_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(),
}; };
const ALL_INSCRIBED = { const ALL_INSCRIBED = {
'tesseract': POLYTOPES.tesseract_all_inscribed(), 'tesseract': POLYTOPES.tesseract_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(),
} }

View File

@ -188,14 +188,14 @@ export const cell24 = () => {
index_nodes(nodes); index_nodes(nodes);
const links = auto_detect_edges(nodes, 8); const links = auto_detect_edges(nodes, 8);
links.map((l) => { // links.map((l) => {
const ls = [ l.source, l.target ].map((nid) => node_by_id(nodes, nid).label); // const ls = [ l.source, l.target ].map((nid) => node_by_id(nodes, nid).label);
for ( const c of [1, 2, 3] ) { // for ( const c of [1, 2, 3] ) {
if( ! ls.includes(c) ) { // if( ! ls.includes(c) ) {
l.label = c // l.label = c
} // }
} // }
}); // });
return { return {
nodes: nodes, nodes: nodes,
@ -208,6 +208,28 @@ export const cell24 = () => {
} }
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]);
// face detection for the 120-cell // face detection for the 120-cell
// NOTE: all of these return node ids, not nodes // NOTE: all of these return node ids, not nodes