Stored the test 120-cell colours as a static array for performance
parent
6436efece2
commit
02cfdc5f80
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
||||||
import * as PERMUTE from './permute.js';
|
import * as PERMUTE from './permute.js';
|
||||||
|
|
||||||
import * as CELL120 from './cell120.js';
|
import * as DODECAHEDRA from './dodecahedra.js';
|
||||||
|
|
||||||
function index_nodes(nodes, scale) {
|
function index_nodes(nodes, scale) {
|
||||||
let i = 1;
|
let i = 1;
|
||||||
|
@ -293,7 +293,6 @@ function label_faces_120cell(nodes, faces, cfaces, label) {
|
||||||
console.log(`label faces from ${cfaces}`);
|
console.log(`label faces from ${cfaces}`);
|
||||||
for( const fid of cfaces ) {
|
for( const fid of cfaces ) {
|
||||||
const face = faces.filter((f)=> f.id === fid );
|
const face = faces.filter((f)=> f.id === fid );
|
||||||
console.log(face);
|
|
||||||
if( face.length > 0 ) {
|
if( face.length > 0 ) {
|
||||||
for ( const nid of face[0].nodes ) {
|
for ( const nid of face[0].nodes ) {
|
||||||
ns.add(nid);
|
ns.add(nid);
|
||||||
|
@ -307,13 +306,12 @@ function label_faces_120cell(nodes, faces, cfaces, label) {
|
||||||
function manual_label_120cell(nodes, links) {
|
function manual_label_120cell(nodes, links) {
|
||||||
|
|
||||||
const faces = auto_120cell_faces(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 ];
|
//const cfaces = [ 1, 2, 4, 145, 169 ];
|
||||||
|
|
||||||
console.log(dodecas);
|
|
||||||
let colour = 1;
|
let colour = 1;
|
||||||
for( const dd of dodecas ) {
|
for( const dd of dodecas ) {
|
||||||
label_faces_120cell(nodes, faces, dd.map((f) => f.id), colour);
|
label_faces_120cell(nodes, faces, dd, colour);
|
||||||
colour++;
|
colour++;
|
||||||
if( colour > 8 ) {
|
if( colour > 8 ) {
|
||||||
colour = 1;
|
colour = 1;
|
||||||
|
|
11
testbed.js
11
testbed.js
|
@ -397,7 +397,7 @@ function make_120cell_cells(faces) {
|
||||||
for( const dd of dds ) {
|
for( const dd of dds ) {
|
||||||
const fp = dd_fingerprint(dd);
|
const fp = dd_fingerprint(dd);
|
||||||
if( ! (fp in seen) ) {
|
if( ! (fp in seen) ) {
|
||||||
console.log(`added dodeca ${fp}`);
|
//console.log(`added dodeca ${fp}`);
|
||||||
dodecas.push(dd);
|
dodecas.push(dd);
|
||||||
seen[fp] = 1;
|
seen[fp] = 1;
|
||||||
}
|
}
|
||||||
|
@ -428,4 +428,13 @@ const cell120 = () => {
|
||||||
const nodes = make_120cell_vertices();
|
const nodes = make_120cell_vertices();
|
||||||
const links = auto_detect_edges(nodes, 4);
|
const links = auto_detect_edges(nodes, 4);
|
||||||
const faces = auto_120cell_faces(links);
|
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)
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue