/* ============================================================================= * B06_Section_Cross_Excavation_Geom.ts * 벽 터파기 **기하** — 값은 `common_util_excavation` 한 곳(파이썬 짝 · 거울 시험). 그리기는 * `../B06_Section_UI_Cross_Excavation`(472-3). * ⚠ **비탈을 주지 않는다 — 수직.** 정본 식에 기울기 항이 없다. * ========================================================================== */ import { WALL_BLINDING_DEPTH_M, WALL_BLINDING_WIDTH_M, WALL_FOUNDATION_DEPTH_M, WALL_FOUNDATION_WIDTH_M, WALL_TRENCH_CLEARANCE_M, } from "@util/common_util_excavation"; import type { WallLayout } from "./B06_Section_Cross_Culvert_Types"; /** 「기초유」인가 — 저장 제원 `foundation` 의 값. 비어 있으면 **그리지 않는다**(근거 없음). */ export function foundationChoice(value: unknown): "기초유" | "기초버림" | null { const text = typeof value === "string" ? value.trim() : ""; if (text === "기초유") return "기초유"; if (text === "기초버림") return "기초버림"; return null; } /** * 벽 터파기 — 벽 바닥선 아래로 **수직**. 폭은 바닥 폭 + 여유 0.2, 깊이는 기초 몫. * `foundation` 이 비어 있으면 null — 사용자가 고르기 전에는 근거가 없다. */ export function wallTrench( wall: WallLayout, foundation: "기초유" | "기초버림" | null, ): { widthM: number; depthM: number; left: number; right: number; top: number; bottom: number; } | null { if (foundation === null) return null; const hasFoundation = foundation === "기초유"; const depth = hasFoundation ? WALL_FOUNDATION_DEPTH_M : WALL_BLINDING_DEPTH_M; // 폭: 기초 몫은 정본이 정한 값(0.9 / 0.7), 다만 벽 바닥이 그보다 넓으면 그 폭 + 여유. const baseWidth = Math.abs(wall.bottomFront.offset - wall.bottomBack.offset); const minWidth = hasFoundation ? WALL_FOUNDATION_WIDTH_M : WALL_BLINDING_WIDTH_M; const width = Math.max(minWidth, baseWidth + (hasFoundation ? WALL_TRENCH_CLEARANCE_M : 0)); const center = (wall.bottomFront.offset + wall.bottomBack.offset) / 2; const top = Math.max(wall.bottomFront.elevation, wall.bottomBack.elevation); return { widthM: width, depthM: depth, left: center - width / 2, right: center + width / 2, top, bottom: top - depth, }; }