Stored the test 120-cell colours as a static array for performance

experiments-120-cell
Mike Lynch 2023-08-20 11:28:13 +10:00
parent 6436efece2
commit 02cfdc5f80
3 changed files with 1695 additions and 6 deletions

1682
dodecahedra.js 100644

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
import * as PERMUTE from './permute.js';
import * as CELL120 from './cell120.js';
import * as DODECAHEDRA from './dodecahedra.js';
function index_nodes(nodes, scale) {
let i = 1;
@ -293,7 +293,6 @@ function label_faces_120cell(nodes, faces, cfaces, label) {
console.log(`label faces from ${cfaces}`);
for( const fid of cfaces ) {
const face = faces.filter((f)=> f.id === fid );
console.log(face);
if( face.length > 0 ) {
for ( const nid of face[0].nodes ) {
ns.add(nid);
@ -307,13 +306,12 @@ function label_faces_120cell(nodes, faces, cfaces, label) {
function manual_label_120cell(nodes, links) {
const faces = auto_120cell_faces(links);
const dodecas = CELL120.make_120cell_dodecahedra(faces);
const dodecas = DODECAHEDRA.DODECAHEDRA;
//const cfaces = [ 1, 2, 4, 145, 169 ];
console.log(dodecas);
let colour = 1;
for( const dd of dodecas ) {
label_faces_120cell(nodes, faces, dd.map((f) => f.id), colour);
label_faces_120cell(nodes, faces, dd, colour);
colour++;
if( colour > 8 ) {
colour = 1;

View File

@ -397,7 +397,7 @@ function make_120cell_cells(faces) {
for( const dd of dds ) {
const fp = dd_fingerprint(dd);
if( ! (fp in seen) ) {
console.log(`added dodeca ${fp}`);
//console.log(`added dodeca ${fp}`);
dodecas.push(dd);
seen[fp] = 1;
}
@ -428,4 +428,13 @@ const cell120 = () => {
const nodes = make_120cell_vertices();
const links = auto_detect_edges(nodes, 4);
const faces = auto_120cell_faces(links);
const dodecas = make_120cell_cells(faces);
const ddfaces = dodecas.map((dd) => dd.map((f) => f.id));
console.log(JSON.stringify(ddfaces));
// for( const dodeca of dodecas ) {
// console.log(dodeca.map((f) => f.id)
// }