Refactored dodecahedron
parent
029e6f3161
commit
c481d24f3c
43
polytopes.js
43
polytopes.js
|
@ -685,47 +685,36 @@ function make_dodecahedron_vertices() {
|
||||||
export const dodecahedron = () => {
|
export const dodecahedron = () => {
|
||||||
const nodes = make_dodecahedron_vertices();
|
const nodes = make_dodecahedron_vertices();
|
||||||
const links = auto_detect_edges(nodes, 3);
|
const links = auto_detect_edges(nodes, 3);
|
||||||
|
links.map((l) => l.label = 0);
|
||||||
|
|
||||||
|
for( const p of [ 1, 2, 3, 4, 5 ]) {
|
||||||
|
const tetran = nodes.filter((n) => n.label === p);
|
||||||
|
const tetral = auto_detect_edges(tetran, 3);
|
||||||
|
tetral.map((l) => l.label = p);
|
||||||
|
links.push(...tetral);
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
name: 'dodecahedron',
|
||||||
nodes: nodes,
|
nodes: nodes,
|
||||||
links: links,
|
links: links,
|
||||||
geometry: {
|
|
||||||
node_size: 0.02,
|
|
||||||
link_size: 0.02
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const dodecahedron_some_inscribed = (ps) => {
|
|
||||||
const nodes = make_dodecahedron_vertices();
|
|
||||||
const links = auto_detect_edges(nodes, 3);
|
|
||||||
const all_links = links;
|
|
||||||
all_links.map((l) => l.label = 0);
|
|
||||||
|
|
||||||
for( const p of ps) {
|
|
||||||
const tetran = nodes.filter((n) => n.label === p);
|
|
||||||
const tetral = auto_detect_edges(tetran, 3);
|
|
||||||
tetral.map((l) => l.label = p);
|
|
||||||
all_links.push(...tetral);
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
nodes: nodes,
|
|
||||||
links: all_links,
|
|
||||||
geometry: {
|
geometry: {
|
||||||
node_size: 0.02,
|
node_size: 0.02,
|
||||||
link_size: 0.02
|
link_size: 0.02
|
||||||
},
|
},
|
||||||
|
options: [
|
||||||
|
{ name: "none", links: [ 0 ]},
|
||||||
|
{ name: "one tetrahedron", links: [ 0, 1 ] },
|
||||||
|
{ name: "five tetrahedra", links: [ 0, 1, 2, 3, 4, 5 ] }
|
||||||
|
]
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export const dodecahedron_inscribed = () => dodecahedron_some_inscribed([1]);
|
|
||||||
export const dodecahedron_all_inscribed = () => dodecahedron_some_inscribed([1,2,3,4,5]);
|
|
||||||
|
|
||||||
|
|
||||||
export const build_all = () => {
|
export const build_all = () => {
|
||||||
return [
|
return [
|
||||||
|
dodecahedron(),
|
||||||
cell5(),
|
cell5(),
|
||||||
cell16(),
|
cell16(),
|
||||||
tesseract(),
|
tesseract(),
|
||||||
|
|
Loading…
Reference in New Issue