From 585627f140a8e6733850d24244a9d78ce30b2ce0 Mon Sep 17 00:00:00 2001 From: Mike Lynch Date: Sun, 20 Aug 2023 10:50:28 +1000 Subject: [PATCH] Brute-force dodecahedron detector --- testbed.js | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/testbed.js b/testbed.js index 546f96e..ed1ab4d 100644 --- a/testbed.js +++ b/testbed.js @@ -327,7 +327,6 @@ function find_dodeca_next(faces, dodeca, f1, f2) { function make_dodecahedron(faces, f1, f2) { const dodecahedron = [ f1, f2 ]; - console.log(`First two: ${f1.id} ${f2.id}`); // take f1 as the 'center', get the other four around it from f2 const fs = find_dodeca_mutuals(faces, f1, f2); @@ -382,6 +381,31 @@ function face_to_dodecahedra(faces, f) { return [ d1, d2 ]; } +// brute-force calculation of all dodecahedra + +function dd_fingerprint(dodecahedron) { + const ids = dodecahedron.map((face) => face.id); + ids.sort() + return ids.join(','); +} + +function make_120cell_cells(faces) { + const dodecas = []; + const seen = {}; + for( const face of faces ) { + const dds = face_to_dodecahedra(faces, face); + for( const dd of dds ) { + const fp = dd_fingerprint(dd); + if( ! (fp in seen) ) { + console.log(`added dodeca ${fp}`); + dodecas.push(dd); + seen[fp] = 1; + } + } + } + return dodecas; +} + const cell120 = () => { const nodes = make_120cell_vertices();