Brute-force dodecahedron detector
parent
32644b5d1e
commit
585627f140
26
testbed.js
26
testbed.js
|
@ -327,7 +327,6 @@ function find_dodeca_next(faces, dodeca, f1, f2) {
|
||||||
|
|
||||||
function make_dodecahedron(faces, f1, f2) {
|
function make_dodecahedron(faces, f1, f2) {
|
||||||
const dodecahedron = [ 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
|
// take f1 as the 'center', get the other four around it from f2
|
||||||
const fs = find_dodeca_mutuals(faces, f1, f2);
|
const fs = find_dodeca_mutuals(faces, f1, f2);
|
||||||
|
@ -382,6 +381,31 @@ function face_to_dodecahedra(faces, f) {
|
||||||
return [ d1, d2 ];
|
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 cell120 = () => {
|
||||||
const nodes = make_120cell_vertices();
|
const nodes = make_120cell_vertices();
|
||||||
|
|
Loading…
Reference in New Issue