Cleaned up some redundant old stuff

feature-120-cell-layers
Mike Lynch 2023-11-02 14:13:45 +11:00
parent 6f1c5a58e6
commit c883bd7406
1 changed files with 10 additions and 41 deletions

View File

@ -348,43 +348,6 @@ function label_faces_120cell(nodes, faces, cfaces, label) {
} }
function basic_auto_label_120cell(nodes, links) {
const faces = auto_120cell_faces(links);
const dodecas = DODECAHEDRA.DODECAHEDRA;
//const cfaces = [ 1, 2, 4, 145, 169 ];
let colour = 1;
for( const dd of dodecas ) {
label_faces_120cell(nodes, faces, dd, colour);
colour++;
if( colour > 8 ) {
colour = 1;
}
}
}
function label_120cell(nodes) {
for( const cstr in CELL120.INDEX ) {
label_nodes(nodes, CELL120.INDEX[cstr], Number(cstr));
}
}
function layered_120cell(nodes, max_layer) {
for (const cstr in CELL120.LAYERS ) {
label_nodes(nodes, CELL120.LAYERS[cstr], Number(cstr));
}
}
function link_labels(nodes, link) { function link_labels(nodes, link) {
const n1 = nodes.filter((n) => n.id === link.source); const n1 = nodes.filter((n) => n.id === link.source);
const n2 = nodes.filter((n) => n.id === link.target); const n2 = nodes.filter((n) => n.id === link.target);
@ -399,7 +362,11 @@ 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);
layered_120cell(nodes); nodes.map((n) => n.label = 9); // make all invisible by default
for (const cstr in CELL120.LAYERS ) {
label_nodes(nodes, CELL120.LAYERS[cstr], Number(cstr));
}
links.map((l) => { links.map((l) => {
const labels = link_labels(nodes, l); const labels = link_labels(nodes, l);
@ -413,9 +380,9 @@ export const cell120_layered = (max) => {
const options = []; const options = [];
const layers = []; const layers = [];
for( const i of [ 0, 1, 2, 3, 4, 5, 6 ] ) { for( const i of [ 0, 1, 2, 3, 4, 5, 6, 7 ] ) {
layers.push(i); layers.push(i);
options.push({ options.unshift({
name: "Layer " + String(i), name: "Layer " + String(i),
links: [...layers], links: [...layers],
nodes: [...layers] nodes: [...layers]
@ -441,7 +408,9 @@ export const cell120_inscribed = () => {
const nodes = make_120cell_vertices(); const nodes = make_120cell_vertices();
const links = auto_detect_edges(nodes, 4); const links = auto_detect_edges(nodes, 4);
label_120cell(nodes); for( const cstr in CELL120.INDEX ) {
label_nodes(nodes, CELL120.INDEX[cstr], Number(cstr));
}
links.map((l) => l.label = 0); links.map((l) => l.label = 0);