(Adaptive Loop) Pass 2
This commit is contained in:
34 files changed
+5990
No files matched your search
@@ -0,0 +1,47 @@
|
||||
// Board geometry: three interlocking hexagonal rings (SPEC §4 / docs/board-layout.md).
|
||||
// 12 chamber coordinates chosen so each loop's six slots form a hexagonal ring and
|
||||
// the six shared chambers coincide (rendered once at the overlap). Each loop's
|
||||
// polygon is built from its six slot coordinates in cyclic order; rings overlap
|
||||
// like chain links. Coordinates are in a 440×400 viewBox; the SVG scales to fit.
|
||||
|
||||
import { LOOP_SLOTS, SHARED_SLOTS, SLOT_LOOPS } from "../domain/constants";
|
||||
import type { LoopId } from "../domain/types";
|
||||
|
||||
// [x, y] per slot. Uniques sit on the outer points; shared pairs sit at the
|
||||
// three ring overlaps (A∩B right, A∩C left, B∩C bottom).
|
||||
export const CHAMBER_COORDS: ReadonlyArray<readonly [number, number]> = [
|
||||
[225, 60], // 0 (A)
|
||||
[330, 110], // 1 (A)
|
||||
[310, 165], // 2 (A∩B)
|
||||
[250, 225], // 3 (A∩B)
|
||||
[200, 225], // 4 (A∩C)
|
||||
[140, 165], // 5 (A∩C)
|
||||
[380, 230], // 6 (B)
|
||||
[345, 315], // 7 (B)
|
||||
[275, 360], // 8 (B∩C)
|
||||
[210, 335], // 9 (B∩C)
|
||||
[70, 230], // 10 (C)
|
||||
[105, 315], // 11 (C)
|
||||
];
|
||||
|
||||
export const LOOP_COLORS: Record<LoopId, string> = { A: "#5cc8ff", B: "#ffb45c", C: "#b98cff" };
|
||||
|
||||
export function chamberXY(slot: number): [number, number] {
|
||||
return [CHAMBER_COORDS[slot][0], CHAMBER_COORDS[slot][1]];
|
||||
}
|
||||
|
||||
// Polygon points string for a loop's ring outline (its six slots in cyclic order).
|
||||
export function loopPoints(loop: LoopId): string {
|
||||
return LOOP_SLOTS[loop].map((s) => chamberXY(s).join(",")).join(" ");
|
||||
}
|
||||
|
||||
export function isShared(slot: number): boolean {
|
||||
return SHARED_SLOTS.includes(slot);
|
||||
}
|
||||
|
||||
export function loopsOf(slot: number): LoopId[] {
|
||||
return SLOT_LOOPS[slot];
|
||||
}
|
||||
|
||||
// Center of the board (for objective/fixture label placement offsets).
|
||||
export const VIEWBOX = "0 0 440 400";
|
||||
Reference in new issue
Block a user