/** * Girder pairs over the whole bridge (A1, P1 … Pn, A2 — structureOrder) for the solplate slope S (결정 2026-11-06, Q-SH1). * Pure. Bearing coordinates and z cannot be edited on the screens, so the pairs change only when structures are loaded. */ import type { AbutRecord } from './abut/parse'; import { structureOrder } from './abut/order'; import { type BearingPair, girderPairs, type PairStructure } from './bearing-pair'; import type { PierInput } from './types'; export function bridgePairs(piers: Pick[], abuts: AbutRecord[]): BearingPair[] { const byPier = new Map(piers.map((p) => [p.name, p])); const byAbut = new Map(abuts.map((a) => [a.name, a])); const structures: PairStructure[] = structureOrder(abuts, piers.map((p) => p.name)).map((ref) => { if (ref.kind === 'pier') { const p = byPier.get(ref.name)!; return { name: p.name, bearings: p.bearings.filter((b) => Number.isFinite(b.azimuthDeg)).map((b) => ({ no: b.no, x: b.x, y: b.y, z: b.z, azimuthDeg: b.azimuthDeg })) }; } const a = byAbut.get(ref.name)!; return { name: a.name, bearings: a.bearings.filter((b) => b.azimuthDeg !== undefined).map((b) => ({ no: b.no, x: b.pos.e, y: b.pos.n, z: b.z, azimuthDeg: b.azimuthDeg! })) }; }); return girderPairs(structures); }