Antipode-detector to complete the mapping

This commit is contained in:
Mike Lynch 2026-02-07 11:32:06 +11:00
parent 3c874326a6
commit 7bf5adcb3a

View File

@ -269,3 +269,12 @@ export function equator(i600, b600, apices) {
} }
export function antipode(shape, nid) {
const n0 = shape.nodes.filter((n) => n.id === nid)[0];
const dists = shape.nodes.map((n) => [ dist(n, n0), n ]);
dists.sort((a, b) => b[0] - a[0]);
return dists[0][1].id;
}