diff --git a/label120cell.js b/label120cell.js index 7064d83..82a1f66 100644 --- a/label120cell.js +++ b/label120cell.js @@ -1,5 +1,6 @@ -//testbed for playing with stuff in node repl +// code for generating the 120-cell labels +// has some overlap with permute - FIXME const THREE =require('three'); @@ -133,7 +134,7 @@ function dist2(n1, n2) { return (n1.x - n2.x) ** 2 + (n1.y - n2.y) ** 2 + (n1.z - n2.z) ** 2 + (n1.w - n2.w) ** 2; } -function auto_detect_edges(nodes, neighbours, debug=false) { +export function auto_detect_edges(nodes, neighbours, debug=false) { const seen = {}; const nnodes = nodes.length; const links = []; @@ -168,7 +169,7 @@ function auto_detect_edges(nodes, neighbours, debug=false) { -function make_120cell_vertices() { +export function make_120cell_vertices() { const phi = 0.5 * (1 + Math.sqrt(5)); const r5 = Math.sqrt(5); const phi2 = phi * phi; @@ -230,7 +231,7 @@ function fingerprint(ids) { -function auto_120cell_faces(links) { +export function auto_120cell_faces(links) { const faces = []; const seen = {}; let id = 1; @@ -486,7 +487,7 @@ function colour_next_dodeca_maybe(nodes, links, faces, colours, dd, nextf, nextd const nextvs = dodecahedron_vertices(nextdd); // get the initial colour permutations from the existing labels; const p = []; - for( i = 0; i < 5; i ++ ) { + for( let i = 0; i < 5; i ++ ) { p[i] = colours[nextvs[i]]; } const nlabels = colour_dodecahedron_from_face(nextdd, p); @@ -668,8 +669,9 @@ function arctic(nodes, links, faces, startf, startn, max) { +// this is the one that works -function arctic_two(nodes, links, faces, startf, startn) { +export function label_120cell(nodes, links, faces, startf, startn) { const pole = face_plus_to_dodecahedron(faces, startf, startn); const dds = [ pole ]; @@ -815,7 +817,6 @@ function make_120cell_cells(faces) { for( const dd of dds ) { const fp = dd_fingerprint(dd); if( ! (fp in seen) ) { - //console.log(`added dodeca ${fp}`); const d = { id: i, faces: dd, @@ -927,6 +928,8 @@ function make_dodecahedron_vertices() { } + + // const nodes = make_120cell_vertices(); // const links = auto_detect_edges(nodes, 4); // const faces = auto_120cell_faces(links);