Normalised 5-cell and 16-cell to unit radius

broken-cursed-links
Mike Lynch 2024-04-25 10:57:03 +10:00
parent 1ec7955861
commit aba20124db
1 changed files with 11 additions and 8 deletions

View File

@ -58,16 +58,15 @@ export function auto_detect_edges(nodes, neighbours, debug=false) {
// too small and simple to calculate
export const cell5 = () => {
const r5 = Math.sqrt(5);
const r2 = Math.sqrt(2) / 2;
const c1 = Math.sqrt(5) / 4;
return {
name: '5-cell',
nodes: [
{id:1, label: 1, x: r2, y: r2, z: r2, w: -r2 / r5 },
{id:2, label: 2, x: r2, y: -r2, z: -r2, w: -r2 / r5 },
{id:3, label: 3, x: -r2, y: r2, z: -r2, w: -r2 / r5 },
{id:4, label: 4, x: -r2, y: -r2, z: r2, w: -r2 / r5 },
{id:5, label: 5, x: 0, y: 0, z: 0, w: 4 * r2 / r5 },
{id:1, label: 1, x: c1, y: c1, z: c1, w: -0.25 },
{id:2, label: 2, x: c1, y: -c1, z: -c1, w: -0.25 },
{id:3, label: 3, x: -c1, y: c1, z: -c1, w: -0.25 },
{id:4, label: 4, x: -c1, y: -c1, z: c1, w: -0.25 },
{id:5, label: 5, x: 0, y: 0, z: 0, w: 1 },
],
links: [
{ id:1, source:1, target: 2},
@ -109,7 +108,7 @@ export const cell16 = () => {
nodes[1].label = 4;
index_nodes(nodes);
scale_nodes(nodes, 0.75);
scale_nodes(nodes, 0.5);
const links = auto_detect_edges(nodes, 6);
return {
@ -767,4 +766,8 @@ export const build_all = () => {
cell120_inscribed(),
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))
}