/* ============================================================================= * B06_Section_Cross_Culvert.ts * 배수관 세트 기하 입구 — `computeCulvertLayout` · 고름 키 · 관 겹 꼭짓점. * 그리기(`UI_Cross_Culvert.ts`)는 여기서 받은 좌표를 SVG 로 옮기기만 한다. * ========================================================================== */ import type { CulvertLayout, PipeEnd } from "./B06_Section_Cross_Culvert_Types"; export { MIN_PIPE_COVER_M, computeCulvertLayout } from "./B06_Section_Cross_Culvert_Geom"; export type { BasinLayout, BasinShape, CulvertDesignTrim, CulvertLayout, EndFace, InletStructureChoice, } from "./B06_Section_Cross_Culvert_Geom"; /** 기슭막이 선택 키 — 측점 안에서 어느 벽인지 가린다. 추가 벽은 `extra{n}`. */ // "own" = 배관과 무관한 **독립 기슭막이**(구조물 정본 D군). 조정창·조작값 저장은 // 배관 벽과 같은 체계를 그대로 쓴다(2026-08-28 사용자: 배관측점처럼 이동). export type RevetKey = "inlet" | "outlet" | "own" | `extra${number}` | `bextra${number}`; /** 고름 전용 키 — 벽 키 + 관(118-1) · 도수로 띠(152-4) — 조정창 없음 · 강조만. 조정 함수에는 `RevetKey` 만. */ export type RevetPick = RevetKey | "pipe" | "chute"; // 미세한 틈 방지: 양 끝을 축 방향으로 아주 조금만 밀어 넣는다. 벽 전면이 1:0.3으로 // 기울어 있어 크게 밀면 관 하단이 벽 **바깥으로 삐져나온다**(2026-08-20 사용자 ③ // 위치 어긋남 원인) — 렌더링 틈만 덮을 만큼(2㎝)으로 줄였다. const OVERLAP_M = 0.02; /** 관 한 겹의 유입 · 유출 끝 — 축 법선으로 `delta`(m) 벌림(외경 = 관 두께 · 내경 = 0). */ export function pipeShellCorners(layout: CulvertLayout, delta: number): [PipeEnd, PipeEnd] { const { axis, normal } = layout.pipeAxis; const pushOut = (corner: PipeEnd, dirSign: number): PipeEnd => ({ bottom: { offset: corner.bottom.offset + dirSign * axis.offset * OVERLAP_M, elevation: corner.bottom.elevation + dirSign * axis.elevation * OVERLAP_M, }, top: { offset: corner.top.offset + dirSign * axis.offset * OVERLAP_M, elevation: corner.top.elevation + dirSign * axis.elevation * OVERLAP_M, }, }); const shifted = (corner: PipeEnd): PipeEnd => ({ bottom: { offset: corner.bottom.offset - normal.offset * delta, elevation: corner.bottom.elevation - normal.elevation * delta, }, top: { offset: corner.top.offset + normal.offset * delta, elevation: corner.top.elevation + normal.elevation * delta, }, }); return [ shifted(pushOut(layout.pipeCorners.inlet, -1)), shifted(pushOut(layout.pipeCorners.outlet, 1)), ]; }