feature-120-cell-layers #7
							
								
								
									
										102
									
								
								cellindex.js
									
									
									
									
									
								
							
							
						
						
									
										102
									
								
								cellindex.js
									
									
									
									
									
								
							| @ -1 +1,101 @@ | ||||
| export const INDEX = {"1": [ 27,38,48,49,61,68,74,87,95,98,105,120, 126,131,140,149,156,165,174,179,185,200,207,210,218,223,226,231,234,239,241,248,252,253,258,263,265,272,274,279,284,285,289,296,300,301,306,311,313,320,324,325,331,334,339,342,347,350,356,357,362,367,369,376,378,383,388,389,393,400,403,406,413,414,419,420,425,427,438,440,444,448,449,453,458,460,469,471,473,474,487,488,490,494,499,503,511,512,513,514,525,527,530,532,539,543,546,550,555,558,563,566,572,573,580,581,585,592,593,600],"2":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,28,30,31,34,35,37,40,41,44,46,47,50,51,53,56,57,60,62,63,66,67,69,72,73,76,78,79,82,83,85,88,90,91,93,96,97,100,102,103,106,107,109,112,113,116,118,119,122,123,125,128,129,132,134,135,138,139,141,144,145,148,150,151,154,155,157,160,161,164,166,167,170,171,173,176,177,180,182,183,186,187,189,192,193,196,198,199,202,203,205,208,209,212,214,215],"3":[26,39,45,52,64,65,75,86,94,99,108,117,127,130,137,152,153,168,175,178,188,197,206,211,219,222,227,230,235,238,244,245,251,254,257,264,268,269,273,280,283,286,292,293,299,302,305,312,316,317,321,328,330,335,338,343,348,349,355,358,363,366,370,375,377,384,385,392,394,399,404,405,415,416,417,418,426,428,437,439,441,445,452,456,457,459,470,472,475,476,485,486,491,495,498,502,509,510,515,516,526,528,529,531,538,542,547,551,554,559,562,567,569,576,577,584,588,589,596,597],"4":[32,33,43,54,58,71,77,84,92,101,110,115,121,136,143,146,159,162,169,184,190,195,204,213,220,221,228,229,236,237,242,247,249,256,260,261,266,271,276,277,281,288,290,295,297,304,308,309,315,318,322,327,329,336,340,341,346,351,354,359,361,368,371,374,379,382,387,390,396,397,401,408,409,410,423,424,430,432,433,435,443,447,450,454,461,463,466,468,477,478,483,484,489,493,500,504,507,508,517,518,522,524,533,535,540,544,545,549,553,560,561,568,570,575,578,583,587,590,595,598],"5":[29,36,42,55,59,70,80,81,89,104,111,114,124,133,142,147,158,163,172,181,191,194,201,216,217,224,225,232,233,240,243,246,250,255,259,262,267,270,275,278,282,287,291,294,298,303,307,310,314,319,323,326,332,333,337,344,345,352,353,360,364,365,372,373,380,381,386,391,395,398,402,407,411,412,421,422,429,431,434,436,442,446,451,455,462,464,465,467,479,480,481,482,492,496,497,501,505,506,519,520,521,523,534,536,537,541,548,552,556,557,564,565,571,574,579,582,586,591,594,599]}; | ||||
| export const INDEX = { | ||||
| 	"1": [ | ||||
| 		27,38,48,49,61,68,74,87,95,98,105,120, 126,131,140,149,156,165,174, | ||||
| 		179,185,200,207,210,218,223,226,231,234,239,241,248,252,253,258,263, | ||||
| 		265,272,274,279,284,285,289,296,300,301,306,311,313,320,324,325,331, | ||||
| 		334,339,342,347,350,356,357,362,367,369,376,378,383,388,389,393,400, | ||||
| 		403,406,413,414,419,420,425,427,438,440,444,448,449,453,458,460,469, | ||||
| 		471,473,474,487,488,490,494,499,503,511,512,513,514,525,527,530,532, | ||||
| 		539,543,546,550,555,558,563,566,572,573,580,581,585,592,593,600 | ||||
| 	], | ||||
| 	"2":[ | ||||
| 		1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,28, | ||||
| 		30,31,34,35,37,40,41,44,46,47,50,51,53,56,57,60,62,63,66,67,69,72,73, | ||||
| 		76,78,79,82,83,85,88,90,91,93,96,97,100,102,103,106,107,109,112,113, | ||||
| 		116,118,119,122,123,125,128,129,132,134,135,138,139,141,144,145,148, | ||||
| 		150,151,154,155,157,160,161,164,166,167,170,171,173,176,177,180,182, | ||||
| 		183,186,187,189,192,193,196,198,199,202,203,205,208,209,212,214,215 | ||||
| 		], | ||||
| 	"3":[ | ||||
| 		26,39,45,52,64,65,75,86,94,99,108,117,127,130,137,152,153,168,175, | ||||
| 		178,188,197,206,211,219,222,227,230,235,238,244,245,251,254,257,264, | ||||
| 		268,269,273,280,283,286,292,293,299,302,305,312,316,317,321,328,330, | ||||
| 		335,338,343,348,349,355,358,363,366,370,375,377,384,385,392,394,399, | ||||
| 		404,405,415,416,417,418,426,428,437,439,441,445,452,456,457,459,470, | ||||
| 		472,475,476,485,486,491,495,498,502,509,510,515,516,526,528,529,531, | ||||
| 		538,542,547,551,554,559,562,567,569,576,577,584,588,589,596,597 | ||||
| 		], | ||||
| 	"4":[ | ||||
| 		32,33,43,54,58,71,77,84,92,101,110,115,121,136,143,146,159,162,169, | ||||
| 		184,190,195,204,213,220,221,228,229,236,237,242,247,249,256,260,261, | ||||
| 		266,271,276,277,281,288,290,295,297,304,308,309,315,318,322,327,329, | ||||
| 		336,340,341,346,351,354,359,361,368,371,374,379,382,387,390,396,397, | ||||
| 		401,408,409,410,423,424,430,432,433,435,443,447,450,454,461,463,466, | ||||
| 		468,477,478,483,484,489,493,500,504,507,508,517,518,522,524,533,535, | ||||
| 		540,544,545,549,553,560,561,568,570,575,578,583,587,590,595,598 | ||||
| 		], | ||||
| 	"5":[ | ||||
| 		29,36,42,55,59,70,80,81,89,104,111,114,124,133,142,147,158,163,172, | ||||
| 		181,191,194,201,216,217,224,225,232,233,240,243,246,250,255,259,262, | ||||
| 		267,270,275,278,282,287,291,294,298,303,307,310,314,319,323,326,332, | ||||
| 		333,337,344,345,352,353,360,364,365,372,373,380,381,386,391,395,398, | ||||
| 		402,407,411,412,421,422,429,431,434,436,442,446,451,455,462,464,465, | ||||
| 		467,479,480,481,482,492,496,497,501,505,506,519,520,521,523,534,536, | ||||
| 		537,541,548,552,556,557,564,565,571,574,579,582,586,591,594,599 | ||||
| 		] | ||||
| }; | ||||
| 
 | ||||
| export const LAYERS = { | ||||
| 	"0": [ | ||||
| 		1,317,221,217,313,341,465,417,469,421,37,165,161,269,33,513,113, | ||||
| 		117,517,365 | ||||
| 		], | ||||
| 	"1": [ | ||||
| 		337,457,409,25,153,265,157,29,413,461,105,109,505,361,509,245,241, | ||||
| 		49,177,97,433,89,41,425,169,225,321,93,101,53,437,181,45,173,429, | ||||
| 		325,229,251,255,485,351,453,477,445,347,7,333,249,253,271,163,167, | ||||
| 		267,155,219,223,159,481,449,349,473,345,441,329,5,529,561,81,577, | ||||
| 		129,65,545,497,145,593,533,565,389,373,277,279,375,19,581,133,85, | ||||
| 		69,501,549,597,149,15,367,399,39,519,583,135,487,397,579,515,35, | ||||
| 		483,131,303,301,209,293,213 | ||||
| 		], | ||||
| 	"2":[ | ||||
| 		521,553,385,557,525,273,275,369,17,371,569,121,73,57,489,537,585, | ||||
| 		137,13,363,393,27,507,571,123,475,573,125,395,575,511,31,479,127, | ||||
| 		77,61,541,493,141,589,178,226,170,174,242,230,182,246,9,322,357, | ||||
| 		498,434,50,530,146,353,257,185,261,193,233,11,355,359,263,259,189, | ||||
| 		237,197,326,54,438,502,150,534,335,447,455,95,103,415,319,423,239, | ||||
| 		71,199,551,383,287,419,315,411,331,443,451,99,91,3,343,471,467,115, | ||||
| 		119,235,67,547,195,285,381,405,309,594,390,562,294,210,82,23,406, | ||||
| 		595,310,211,83,566,86,214,598,407,311,24,408,312,599,87,215,567, | ||||
| 		563,295,391 | ||||
| 		], | ||||
| 	"3":[ | ||||
| 		297,201,299,205,289,42,426,490,138,522,494,430,46,526,142,63,543, | ||||
| 		191,283,379,339,459,463,111,107,59,187,539,377,281,546,382,286,194, | ||||
| 		66,114,118,466,342,470,384,288,550,70,198,503,439,55,535,151,51,435, | ||||
| 		499,147,531,212,296,302,304,216 | ||||
| 		], | ||||
| 	"4":[ | ||||
| 		386,554,290,74,202,586,401,305,558,78,590,206,307,403,21,402,306, | ||||
| 		587,75,203,555,79,559,207,291,387,591,308,404,22,462,338,458,110, | ||||
| 		106,2,410,314,418,98,90,450,58,186,442,330,234,282,378,538,62,190, | ||||
| 		238,94,102,446,334,454,284,380,542,422,414,318,495,431,327,260,264, | ||||
| 		356,12,360,47,527,143,200,192,240,43,427,323,247,243,171,227,179,491, | ||||
| 		523,139,183,175,231,258,262,358,354,10,196,236,188,130,578,398,596, | ||||
| 		548,132,580,84,514,34,482,148,68,500,582,518,400,366,16,134,486,38, | ||||
| 		600,552,88,136,584,152,72,504,20,376,392,536,568,374,278,280,532,564 | ||||
| 		], | ||||
| 	"5":[ | ||||
| 		570,394,298,300,506,14,362,396,574,510,122,474,26,204,208,292,126, | ||||
| 		30,478,588,540,76,124,572,140,60,492,18,370,388,524,556,372,276,274, | ||||
| 		592,144,80,528,560,544,64,496,222,218,154,266,158,162,270,166,6,346, | ||||
| 		350,254,250,332,452,484,444,476,8,348,336,448,480,128,352,488,456, | ||||
| 		252,256,328,232,432,176,48,440,56,184,104,96,324,228,172,428,44, | ||||
| 		180,52,436,248,244,92,100,516,368,36,272,164,116,520,120,468,420, | ||||
| 		40,168,472,424,344 | ||||
| 		], | ||||
| 	"6":[364,268,508,28,156,576,512,108,112,32,160,460,412,464,340,416, | ||||
| 		220,224,316,320,4 | ||||
| 		] | ||||
| } | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
| // code for generating the 120-cell labels
 | ||||
| // has some overlap with permute - FIXME
 | ||||
| 
 | ||||
| const THREE =require('three'); | ||||
| const THREE = require('three'); | ||||
| 
 | ||||
| function pandita(a) { | ||||
| 	const n = a.length; | ||||
| @ -669,11 +669,12 @@ function arctic(nodes, links, faces, startf, startn, max) { | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| // this is the one that works
 | ||||
| // this is the final one that works for the whole 120-cell
 | ||||
| 
 | ||||
| export function label_120cell(nodes, links, faces, startf, startn) { | ||||
| 	const pole = face_plus_to_dodecahedron(faces, startf, startn); | ||||
| 	const dds = [ pole ]; | ||||
| 	const dd_families = { "0": [ pole ] } | ||||
| 
 | ||||
| 	const seen = {}; | ||||
| 	seen[dd_fingerprint(pole)] = true; | ||||
| @ -681,12 +682,15 @@ export function label_120cell(nodes, links, faces, startf, startn) { | ||||
| 	const colours = colour_dodecahedron_from_face(dds[0], [ 1, 2, 3, 4, 5 ] ); | ||||
| 	const vs = dodecahedron_vertices(dds[0]); | ||||
| 
 | ||||
| 	dd_families["1"] = []; | ||||
| 
 | ||||
| 	for( const face of pole ) { | ||||
| 		const [ nextdd, ncolours ] = follow_and_colour( | ||||
| 			nodes, links, faces, colours, pole, face | ||||
| 		); | ||||
| 		add_colours(colours, ncolours); | ||||
| 		dds.push(nextdd); | ||||
| 		dd_families["1"].push(nextdd); | ||||
| 		seen[dd_fingerprint(nextdd)] = true; | ||||
| 	} | ||||
| 
 | ||||
| @ -695,6 +699,8 @@ export function label_120cell(nodes, links, faces, startf, startn) { | ||||
|     // 1, 12, 20, 12, 30 = 75
 | ||||
|     // 0  1   13, 33, 45
 | ||||
| 
 | ||||
| 	dd_families["2"] = []; | ||||
| 
 | ||||
| 	for( const a of dds.slice(1, 13) ) { | ||||
| 		for( const i of [ 6, 7, 8, 9, 10 ] ) { | ||||
| 			const [ nextdd, ncolours ] = follow_and_colour( | ||||
| @ -704,6 +710,7 @@ export function label_120cell(nodes, links, faces, startf, startn) { | ||||
| 			if( !(fp in seen) ) { | ||||
| 				add_colours(colours, ncolours); | ||||
| 				dds.push(nextdd); | ||||
| 				dd_families["2"].push(nextdd); | ||||
| 				seen[fp] = true; | ||||
| 			} | ||||
| 		} | ||||
| @ -711,6 +718,7 @@ export function label_120cell(nodes, links, faces, startf, startn) { | ||||
| 
 | ||||
| 	// meridians = 45
 | ||||
| 
 | ||||
| 	dd_families["3"] = []; | ||||
| 	for( const a of dds.slice(1, 13) ) { | ||||
| 		const [ nextdd, ncolours ] = follow_and_colour( | ||||
| 			nodes, links, faces, colours, a, a[11] | ||||
| @ -719,11 +727,16 @@ export function label_120cell(nodes, links, faces, startf, startn) { | ||||
| 		if( !(fp in seen) ) { | ||||
| 			add_colours(colours, ncolours); | ||||
| 			dds.push(nextdd); | ||||
| 			dd_families["3"].push(nextdd); | ||||
| 			seen[fp] = true; | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	// the 30 equatorials?
 | ||||
| 
 | ||||
| 
 | ||||
| 	dd_families["4"] = []; | ||||
| 
 | ||||
| 	for( const a of dds.slice(13, 46) ) { | ||||
| 		for( const i of [ 6, 7, 8, 9, 10 ] ) { | ||||
| 			const [ nextdd, ncolours ] = follow_and_colour( | ||||
| @ -732,12 +745,15 @@ export function label_120cell(nodes, links, faces, startf, startn) { | ||||
| 			const fp = dd_fingerprint(nextdd); | ||||
| 			if( !(fp in seen) ) { | ||||
| 				add_colours(colours, ncolours); | ||||
| 				dd_families["4"].push(nextdd); | ||||
| 				dds.push(nextdd); | ||||
| 				seen[fp] = true; | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	dd_families["5"] = []; | ||||
| 
 | ||||
| 	for( const a of dds.slice(33, 76) ) { | ||||
| 		for( const i of [ 6, 7, 8, 9, 10 ] ) { | ||||
| 			const [ nextdd, ncolours ] = follow_and_colour( | ||||
| @ -747,12 +763,18 @@ export function label_120cell(nodes, links, faces, startf, startn) { | ||||
| 			if( !(fp in seen) ) { | ||||
| 				add_colours(colours, ncolours); | ||||
| 				dds.push(nextdd); | ||||
| 				dd_families["5"].push(nextdd); | ||||
| 				seen[fp] = true; | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 
 | ||||
| 	// this should get the rest or explode!
 | ||||
| 
 | ||||
| 	dd_families["6"] = []; | ||||
| 
 | ||||
| 
 | ||||
| 	for( const a of dds ) { | ||||
| 		for( const i of [ 6, 7, 8, 9, 10 ] ) { | ||||
| 			const [ nextdd, ncolours ] = follow_and_colour( | ||||
| @ -761,6 +783,7 @@ export function label_120cell(nodes, links, faces, startf, startn) { | ||||
| 			const fp = dd_fingerprint(nextdd); | ||||
| 			if( !(fp in seen) ) { | ||||
| 				add_colours(colours, ncolours); | ||||
| 				dd_families["6"].push(nextdd); | ||||
| 				dds.push(nextdd); | ||||
| 				seen[fp] = true; | ||||
| 			} | ||||
| @ -774,7 +797,7 @@ export function label_120cell(nodes, links, faces, startf, startn) { | ||||
| 	} | ||||
| 
 | ||||
| 
 | ||||
| 	return { dodecahedra: dds, labels: labels }; | ||||
| 	return { dodecahedra: dds, labels: labels, families: dd_families }; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| @ -928,11 +951,44 @@ function make_dodecahedron_vertices() { | ||||
| } | ||||
|   | ||||
| 
 | ||||
| // this one does the coherent indexing / partition into 600-cells
 | ||||
| 
 | ||||
| export function make_labelled_120cell() { | ||||
| 	const nodes = make_120cell_vertices(); | ||||
| 	const links = auto_detect_edges(nodes, 4); | ||||
| 	const faces = auto_120cell_faces(links); | ||||
| 
 | ||||
| 	const labelled = label_120cell(nodes, links, faces, faces[0], 341); | ||||
| 	return labelled; | ||||
| } | ||||
| 
 | ||||
| export function make_layered_120cell() { | ||||
| 	const labelled = make_labelled_120cell(); | ||||
| 
 | ||||
| 	// relabel by layer
 | ||||
| 
 | ||||
| 	const layer_dds = labelled["families"]; | ||||
| 	const vertices_layers = {}; | ||||
| 	const seen = {}; | ||||
| 
 | ||||
| 	for( const layer of [ "0", "1", "2", "3", "4", "5", "6"] ) { | ||||
| 		vertices_layers[layer] = []; | ||||
| 		for( const dd of layer_dds[layer] ) { | ||||
| 			for( const face of dd ) { | ||||
| 				for( const n of face.nodes ) { | ||||
| 					if( !seen[n] ) { | ||||
| 						vertices_layers[layer].push(n); | ||||
| 						seen[n] = true; | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 	return vertices_layers; | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| // const nodes = make_120cell_vertices();
 | ||||
| // const links = auto_detect_edges(nodes, 4);
 | ||||
| // const faces = auto_120cell_faces(links);
 | ||||
| 
 | ||||
| 
 | ||||
| // console.log("Calculating 120-cell colours")
 | ||||
|  | ||||
							
								
								
									
										3
									
								
								main.js
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								main.js
									
									
									
									
									
								
							| @ -23,6 +23,9 @@ scene.add(light); | ||||
| const amblight = new THREE.AmbientLight(0xffffff, 0.5); | ||||
| scene.add(amblight); | ||||
| 
 | ||||
| camera.position.set(1, 1, 3); | ||||
| 
 | ||||
| camera.lookAt(0, 0, 0); | ||||
| camera.position.z = 4; | ||||
| 
 | ||||
| const renderer = new THREE.WebGLRenderer({antialias: true}); | ||||
|  | ||||
							
								
								
									
										21
									
								
								polytopes.js
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								polytopes.js
									
									
									
									
									
								
							| @ -339,13 +339,6 @@ function label_nodes(nodes, ids, label) { | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| function label_faces_120cell(nodes, faces, cfaces, label) { | ||||
| 	const ns = new Set(); | ||||
| 	for( const fid of cfaces ) { | ||||
| @ -386,6 +379,14 @@ function label_120cell(nodes) { | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| function layered_120cell(nodes) { | ||||
| 
 | ||||
| 	for (const cstr in CELL120.LAYERS ) { | ||||
| 			label_nodes(nodes, CELL120.LAYERS[cstr], Number(cstr)); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| function link_labels(nodes, link) { | ||||
| 	const n1 = nodes.filter((n) => n.id === link.source); | ||||
| @ -399,7 +400,8 @@ export const cell120 = () => { | ||||
| 	const nodes  = make_120cell_vertices(); | ||||
| 	const links = auto_detect_edges(nodes, 4); | ||||
| 
 | ||||
| 	label_120cell(nodes); | ||||
| 	//label_120cell(nodes);
 | ||||
| 	layered_120cell(nodes); | ||||
| 
 | ||||
| 	return { | ||||
| 		nodes: nodes, | ||||
| @ -412,6 +414,9 @@ export const cell120 = () => { | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| const cell120_some_inscribed = (ps) => { | ||||
| 	const nodes  = make_120cell_vertices(); | ||||
| 	const links = auto_detect_edges(nodes, 4); | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user