Normalised 5-cell and 16-cell to unit radius
parent
1ec7955861
commit
aba20124db
19
polytopes.js
19
polytopes.js
|
@ -58,16 +58,15 @@ export function auto_detect_edges(nodes, neighbours, debug=false) {
|
||||||
// too small and simple to calculate
|
// too small and simple to calculate
|
||||||
|
|
||||||
export const cell5 = () => {
|
export const cell5 = () => {
|
||||||
const r5 = Math.sqrt(5);
|
const c1 = Math.sqrt(5) / 4;
|
||||||
const r2 = Math.sqrt(2) / 2;
|
|
||||||
return {
|
return {
|
||||||
name: '5-cell',
|
name: '5-cell',
|
||||||
nodes: [
|
nodes: [
|
||||||
{id:1, label: 1, x: r2, y: r2, z: r2, w: -r2 / r5 },
|
{id:1, label: 1, x: c1, y: c1, z: c1, w: -0.25 },
|
||||||
{id:2, label: 2, x: r2, y: -r2, z: -r2, w: -r2 / r5 },
|
{id:2, label: 2, x: c1, y: -c1, z: -c1, w: -0.25 },
|
||||||
{id:3, label: 3, x: -r2, y: r2, z: -r2, w: -r2 / r5 },
|
{id:3, label: 3, x: -c1, y: c1, z: -c1, w: -0.25 },
|
||||||
{id:4, label: 4, x: -r2, y: -r2, z: r2, w: -r2 / r5 },
|
{id:4, label: 4, x: -c1, y: -c1, z: c1, w: -0.25 },
|
||||||
{id:5, label: 5, x: 0, y: 0, z: 0, w: 4 * r2 / r5 },
|
{id:5, label: 5, x: 0, y: 0, z: 0, w: 1 },
|
||||||
],
|
],
|
||||||
links: [
|
links: [
|
||||||
{ id:1, source:1, target: 2},
|
{ id:1, source:1, target: 2},
|
||||||
|
@ -109,7 +108,7 @@ export const cell16 = () => {
|
||||||
nodes[1].label = 4;
|
nodes[1].label = 4;
|
||||||
|
|
||||||
index_nodes(nodes);
|
index_nodes(nodes);
|
||||||
scale_nodes(nodes, 0.75);
|
scale_nodes(nodes, 0.5);
|
||||||
const links = auto_detect_edges(nodes, 6);
|
const links = auto_detect_edges(nodes, 6);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -768,3 +767,7 @@ export const build_all = () => {
|
||||||
cell120_layered()
|
cell120_layered()
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const radii = (shape) => {
|
||||||
|
return shape.nodes.map(n => Math.sqrt(n.x * n.x + n.y * n.y + n.z * n.z + n.w * n.w))
|
||||||
|
}
|
Loading…
Reference in New Issue